diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2020-01-07 23:45:24 +0000 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2020-01-08 09:52:26 -0800 |
commit | 51fc90002dcbf057bca644a5bb347f5b95b921e9 (patch) | |
tree | eb6b94dbfc65acb59360518fd9bf83feb07f4f14 | |
parent | 447870f5e8d70c5be3bba2d7e866bf26420b1260 (diff) | |
download | nitrocli-51fc90002dcbf057bca644a5bb347f5b95b921e9.tar.gz nitrocli-51fc90002dcbf057bca644a5bb347f5b95b921e9.tar.bz2 |
Set possible values for all enum options and arguments
This patch adds the possible_values method to the structopt attributes
for all enum options and arguments using the all_str function added in
the previous patch. Therefore, the help messages now also list the
possible values for these options.
-rw-r--r-- | nitrocli/src/args.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index 2e6b165..6c52225 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -77,7 +77,7 @@ pub struct Args { #[structopt(short, long, parse(from_occurrences))] verbose: u8, /// Selects the device model to connect to - #[structopt(short, long)] + #[structopt(short, long, possible_values = &DeviceModel::all_str())] model: Option<DeviceModel>, #[structopt(subcommand)] cmd: Command, @@ -219,7 +219,7 @@ pub struct OtpArgs { #[derive(Debug, PartialEq, structopt::StructOpt)] pub struct OtpClearArgs { /// The OTP algorithm to use - #[structopt(short, long, default_value = "totp")] + #[structopt(short, long, default_value = "totp", possible_values = &OtpAlgorithm::all_str())] algorithm: OtpAlgorithm, /// The OTP slot to clear slot: u8, @@ -229,7 +229,7 @@ pub struct OtpClearArgs { #[derive(Debug, PartialEq, structopt::StructOpt)] pub struct OtpGetArgs { /// The OTP algorithm to use - #[structopt(short, long, default_value = "totp")] + #[structopt(short, long, default_value = "totp", possible_values = &OtpAlgorithm::all_str())] algorithm: OtpAlgorithm, /// The time to use for TOTP generation (Unix timestamp) [default: system time] #[structopt(short, long)] @@ -242,10 +242,10 @@ pub struct OtpGetArgs { #[derive(Debug, PartialEq, structopt::StructOpt)] pub struct OtpSetArgs { /// The OTP algorithm to use - #[structopt(short, long, default_value = "totp")] + #[structopt(short, long, default_value = "totp", possible_values = &OtpAlgorithm::all_str())] algorithm: OtpAlgorithm, /// The number of digits to use for the one-time password - #[structopt(short, long, default_value = "6")] + #[structopt(short, long, default_value = "6", possible_values = &OtpMode::all_str())] digits: OtpMode, /// The counter value for HOTP #[structopt(short, long, default_value = "0")] @@ -288,7 +288,7 @@ pub struct PinClearArgs {} #[derive(Debug, PartialEq, structopt::StructOpt)] pub struct PinSetArgs { /// The PIN type to change - #[structopt(name = "type")] + #[structopt(name = "type", possible_values = &pinentry::PinType::all_str())] pintype: pinentry::PinType, } @@ -369,7 +369,7 @@ pub struct UnencryptedArgs { #[derive(Debug, PartialEq, structopt::StructOpt)] pub struct UnencryptedSetArgs { /// The mode to change to - #[structopt(name = "type")] + #[structopt(name = "type", possible_values = &UnencryptedVolumeMode::all_str())] mode: UnencryptedVolumeMode, } |