From c310d5376fb3ad7e181487910d269c7e1169259b Mon Sep 17 00:00:00 2001 From: holly sparkles Date: Wed, 2 Aug 2023 10:09:49 +0200 Subject: [PATCH] fix: fixed the `--key` argument not being used --- src/main.rs | 4 +--- src/util.rs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index f9517c8..fa331ee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,8 +7,6 @@ mod bwutil; /// Environment variable housing an existing Bitwarden session. const SESSION_ENV_KEY: &str = "BW_SESSION"; -/// Environment variable referencing the name of the field containing the SSH key filename. -const BW_FIELD_KEY_FILENAME: &str = "private"; /// Environment variable referencing the name of the field containing the SSH key passphrase (if any). const BW_FIELD_KEY_PASSPHRASE: &str = "passphrase"; @@ -43,7 +41,7 @@ fn main() -> Result<()> { let mut key_filename = String::new(); let mut key_passphrase = String::new(); for field in fields { - if field.name.to_lowercase().eq(&String::from(BW_FIELD_KEY_FILENAME).to_lowercase()) { + if field.name.to_lowercase().eq(&args.key.to_lowercase()) { key_filename.push_str(&field.value); } if field.name.to_lowercase().eq(&String::from(BW_FIELD_KEY_PASSPHRASE).to_lowercase()) { diff --git a/src/util.rs b/src/util.rs index 9421fed..a9c551d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -11,7 +11,7 @@ pub struct Cli { pub debug: bool, #[options(help = "folder name to use to search for SSH keys", default = "ssh-agent")] pub folder: String, - #[options(help = "custom field name where the private key is stored", meta = "PRIVATE_KEY", default = "private-key")] + #[options(help = "custom field name where the private key filename is stored", meta = "NAME", default = "private")] pub key: String, #[options(help = "custom field name where the key passphrase is stored", meta = "PASS", default = "passphrase")] pub passphrase: String, -- libgit2 1.7.2