feat: returns error code

This commit is contained in:
2022-08-05 22:29:27 +08:00
parent 2bfaf5dfcd
commit b442232cf9
4 changed files with 7 additions and 4 deletions

2
Cargo.lock generated
View File

@@ -376,7 +376,7 @@ dependencies = [
[[package]] [[package]]
name = "card-cli" name = "card-cli"
version = "1.4.0" version = "1.4.1"
dependencies = [ dependencies = [
"authenticator", "authenticator",
"base64 0.13.0", "base64 0.13.0",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "card-cli" name = "card-cli"
version = "1.4.0" version = "1.4.1"
authors = ["Hatter Jiang <jht5945@gmail.com>"] authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018" edition = "2018"

View File

@@ -85,6 +85,7 @@ impl Command for CommandImpl {
} }
} else { } else {
warning!("YubiKey not found"); warning!("YubiKey not found");
return Ok(Some(1));
} }
Ok(None) Ok(None)

View File

@@ -44,8 +44,10 @@ impl DefaultCommandImpl {
} }
fn main() { fn main() {
if let Err(e) = inner_main() { match inner_main() {
failure_and_exit!("Run cli error: {}", e); Err(e) => failure_and_exit!("Run cli error: {}", e),
Ok(Some(code)) => std::process::exit(code),
Ok(None) => (),
} }
} }