summaryrefslogtreecommitdiff
path: root/src/args.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-01-07 23:45:24 +0000
committerDaniel Mueller <deso@posteo.net>2020-01-07 23:45:24 +0000
commitbf0cb13366d5125ddbf2c741f5c71678f25c1eaf (patch)
treea2a414e09dd26f948c4b05df228728b91a056709 /src/args.rs
parent5e3ece42ee1ac765433fdcc05b8eb47a548051f1 (diff)
downloadnitrocli-bf0cb13366d5125ddbf2c741f5c71678f25c1eaf.tar.gz
nitrocli-bf0cb13366d5125ddbf2c741f5c71678f25c1eaf.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.
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/args.rs b/src/args.rs
index e742f7c..8003822 100644
--- a/src/args.rs
+++ b/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,
}