From 6917be7ab3c5a9d47866a45855c836a9cc6f86ff Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sat, 25 Jan 2020 20:33:57 +0100 Subject: 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. --- src/args.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/args.rs') 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, + /// 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, /// Disables the cache for all secrets. #[structopt(long, global = true)] pub no_cache: bool, -- cgit v1.2.3