aboutsummaryrefslogtreecommitdiff
path: root/src/args.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-09-08 18:23:30 +0200
committerDaniel Mueller <deso@posteo.net>2021-01-10 17:37:57 -0800
commit9593dfd03a6ca085d649ca090b6ec5e5f0104e78 (patch)
treecef944516af5c92561c2610f9c8a21776e95cac9 /src/args.rs
parent9975f8810399d5e535f2e2fd62b4dc56b313f955 (diff)
downloadnitrocli-9593dfd03a6ca085d649ca090b6ec5e5f0104e78.tar.gz
nitrocli-9593dfd03a6ca085d649ca090b6ec5e5f0104e78.tar.bz2
Add --usb-path option to select device
This patch adds the --usb-path option as an additional way to filter the Nitrokey device to connect to. While the serial number is a better identifier in theory, the Nitrokey Storage devices do not send their serial number in the USB device descriptor. Having the --usb-path options allows users to select one of multiple Nitrokey Storage devices. While we could directly call the nitrokey::Manager::connect_path function with the specified path, we integrate the --usb-path option into the existing find_device function for consistent error messages and to avoid having to duplicate the --model and --serial-number checks.
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/args.rs b/src/args.rs
index 0d77806..80abe17 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -23,6 +23,9 @@ pub struct Args {
number_of_values = 1
)]
pub serial_numbers: Vec<nitrokey::SerialNumber>,
+ /// Sets the USB path of the device to connect to
+ #[structopt(long, global = true)]
+ pub usb_path: Option<String>,
/// Disables the cache for all secrets.
#[structopt(long, global = true)]
pub no_cache: bool,