From af14d982cfcf0cee9d364458cd9495bb981c4c98 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Mon, 27 May 2019 10:24:56 -0700 Subject: Remove deprecated --ascii option of otp set subcommand The --ascii option of the otp set subcommand has been deprecated a while in favor of --format. As the next release is slated to be a major one breaking backwards compatibility, this change removes this option for good. --- nitrocli/CHANGELOG.md | 1 + nitrocli/src/args.rs | 21 +-------------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/nitrocli/CHANGELOG.md b/nitrocli/CHANGELOG.md index 716ebc6..601284f 100644 --- a/nitrocli/CHANGELOG.md +++ b/nitrocli/CHANGELOG.md @@ -4,6 +4,7 @@ Unreleased - Renamed `storage` command to `encrypted` - Removed `storage status` subcommand - Moved its output into `status` command +- Removed previously deprecated `--ascii` option from `otp set` command 0.2.4 diff --git a/nitrocli/src/args.rs b/nitrocli/src/args.rs index c043938..765da89 100644 --- a/nitrocli/src/args.rs +++ b/nitrocli/src/args.rs @@ -545,7 +545,6 @@ pub fn otp_set(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { let mut digits = OtpMode::SixDigits; let mut counter: u64 = 0; let mut time_window: u16 = 30; - let mut ascii = false; let mut secret_format: Option = None; let fmt_help = format!( "The format of the secret ({})", @@ -570,7 +569,7 @@ pub fn otp_set(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { let _ = parser.refer(&mut secret).required().add_argument( "secret", argparse::Store, - "The secret to store on the slot as a hexadecimal string (unless --ascii is set)", + "The secret to store on the slot as a hexadecimal string (unless overwritten by --format)", ); let _ = parser.refer(&mut digits).add_option( &["-d", "--digits"], @@ -587,11 +586,6 @@ pub fn otp_set(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { argparse::Store, "The time window for TOTP (default: 30)", ); - let _ = parser.refer(&mut ascii).add_option( - &["--ascii"], - argparse::StoreTrue, - "Interpret the given secret as an ASCII string of the secret (deprecated, use --format instead)" - ); let _ = parser.refer(&mut secret_format).add_option( &["-f", "--format"], argparse::StoreOption, @@ -599,19 +593,6 @@ pub fn otp_set(ctx: &mut ExecCtx<'_>, args: Vec) -> Result<()> { ); parse(ctx, parser, args)?; - if ascii { - if secret_format.is_some() { - return Err(Error::from( - "The --format and the --ascii option cannot be used at the same time", - )); - } - - println!( - ctx, - "Warning: The --ascii option is deprecated. Please use --format ascii instead." - )?; - secret_format = Some(OtpSecretFormat::Ascii); - } let secret_format = secret_format.unwrap_or(OtpSecretFormat::Hex); let data = nitrokey::OtpSlotData { -- cgit v1.2.3