aboutsummaryrefslogtreecommitdiff
path: root/src/args.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-01-25 20:33:57 +0100
committerDaniel Mueller <deso@posteo.net>2020-09-07 10:14:21 -0700
commit6917be7ab3c5a9d47866a45855c836a9cc6f86ff (patch)
treeca75486d09c9656e1bbf8ac7c68b5807483cef01 /src/args.rs
parent4d25d79f18cd2c5627c46727b425c745c78cf942 (diff)
downloadnitrocli-6917be7ab3c5a9d47866a45855c836a9cc6f86ff.tar.gz
nitrocli-6917be7ab3c5a9d47866a45855c836a9cc6f86ff.tar.bz2
Add --serial-number option
This patch adds the --serial-number option that allows the user to filter the attached Nitrokey devices by serial number. As the Nitrokey Storage does not include its serial number in the USB device descriptor and as we don't want to connect to it just to query the serial number, this option only works for Nitrokey Storage devices.
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/args.rs b/src/args.rs
index 3052afa..0d77806 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -13,6 +13,16 @@ pub struct Args {
/// Selects the device model to connect to
#[structopt(short, long, global = true, possible_values = &DeviceModel::all_str())]
pub model: Option<DeviceModel>,
+ /// Sets the serial number of the device to connect to. Can be set
+ /// multiple times to allow multiple serial numbers
+ // TODO: Add short options (avoid collisions).
+ #[structopt(
+ long = "serial-number",
+ global = true,
+ multiple = true,
+ number_of_values = 1
+ )]
+ pub serial_numbers: Vec<nitrokey::SerialNumber>,
/// Disables the cache for all secrets.
#[structopt(long, global = true)]
pub no_cache: bool,