feat: v1.10.5, improve list json outputs

This commit is contained in:
2024-09-12 00:54:56 +08:00
parent 582ea8a9bb
commit 81149f6aa2
3 changed files with 11 additions and 2 deletions

2
Cargo.lock generated
View File

@@ -487,7 +487,7 @@ dependencies = [
[[package]]
name = "card-cli"
version = "1.10.4"
version = "1.10.5"
dependencies = [
"authenticator 0.3.1",
"base64 0.21.7",

View File

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

View File

@@ -29,6 +29,15 @@ impl Command for CommandImpl {
if let Ok(pin_retries) = yk.get_pin_retries() {
json.insert("pin_retries", pin_retries.to_string());
}
if let Ok(chuid) = yk.chuid() {
json.insert("chuid", chuid.to_string());
}
if let Ok(ccuid) = yk.cccid() {
json.insert("ccuid", ccuid.to_string());
}
if let Ok(piv_keys) = yk.piv_keys() {
json.insert("keys", piv_keys.iter().map(|k| format!("{}", k.slot())).collect::<Vec<_>>().join(", "));
}
println!("{}", serde_json::to_string_pretty(&json).expect("Convert to JSON failed!"));
} else {