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]]
name = "card-cli"
version = "1.4.0"
version = "1.4.1"
dependencies = [
"authenticator",
"base64 0.13.0",

View File

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

View File

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

View File

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