aboutsummaryrefslogtreecommitdiff
path: root/src/commands.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2020-09-29 19:18:56 +0200
committerRobin Krahl <robin.krahl@ireas.org>2020-10-02 11:58:21 +0200
commita6538455de33f6d09dfa4011fbbdaa6e59b132f4 (patch)
tree7f7fcfd2150a56f3c88b2371b63486090e22d207 /src/commands.rs
parent458d87d2a7fb31beea3e965bd77d7d0ce25eb4b4 (diff)
downloadnitrocli-nitrokey-v0.8.0.tar.gz
nitrocli-nitrokey-v0.8.0.tar.bz2
Rename numlock, capslock, scrollock optionsnitrokey-v0.8.0
This patch renames the options for the config set command: --numlock ==> --num-lock --capslock ==> --caps-lock --scrolllock ==> --scroll-lock --no-numlock ==> --no-num-lock --no-capslock ==> --no-caps-lock --no-scrolllock ==> --no-scroll-lock The original naming was based on a typo in nitrokey-rs (scrollock vs. scrolllock). Also, the typical spelling for the keys is Num Lock, Caps Lock and Scroll Lock, so using a hyphen is a more natural.
Diffstat (limited to 'src/commands.rs')
-rw-r--r--src/commands.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/commands.rs b/src/commands.rs
index c5a3b11..29f3b08 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -657,9 +657,9 @@ pub fn config_get(ctx: &mut Context<'_>) -> anyhow::Result<()> {
println!(
ctx,
r#"Config:
- numlock binding: {nl}
- capslock binding: {cl}
- scrollock binding: {sl}
+ num lock binding: {nl}
+ caps lock binding: {cl}
+ scroll lock binding: {sl}
require user PIN for OTP: {otp}"#,
nl = format_option(config.num_lock),
cl = format_option(config.caps_lock),
@@ -672,12 +672,12 @@ pub fn config_get(ctx: &mut Context<'_>) -> anyhow::Result<()> {
/// Write the Nitrokey configuration.
pub fn config_set(ctx: &mut Context<'_>, args: args::ConfigSetArgs) -> anyhow::Result<()> {
- let numlock = args::ConfigOption::try_from(args.no_numlock, args.numlock, "numlock")
- .context("Failed to apply numlock configuration")?;
- let capslock = args::ConfigOption::try_from(args.no_capslock, args.capslock, "capslock")
- .context("Failed to apply capslock configuration")?;
- let scrollock = args::ConfigOption::try_from(args.no_scrollock, args.scrollock, "scrollock")
- .context("Failed to apply scrollock configuration")?;
+ let num_lock = args::ConfigOption::try_from(args.no_num_lock, args.num_lock, "numlock")
+ .context("Failed to apply num lock configuration")?;
+ let caps_lock = args::ConfigOption::try_from(args.no_caps_lock, args.caps_lock, "capslock")
+ .context("Failed to apply caps lock configuration")?;
+ let scroll_lock = args::ConfigOption::try_from(args.no_scroll_lock, args.scroll_lock, "scrollock")
+ .context("Failed to apply scroll lock configuration")?;
let otp_pin = if args.otp_pin {
Some(true)
} else if args.no_otp_pin {
@@ -692,9 +692,9 @@ pub fn config_set(ctx: &mut Context<'_>, args: args::ConfigSetArgs) -> anyhow::R
.get_config()
.context("Failed to get current configuration")?;
let config = nitrokey::Config {
- num_lock: numlock.or(config.num_lock),
- caps_lock: capslock.or(config.caps_lock),
- scroll_lock: scrollock.or(config.scroll_lock),
+ num_lock: num_lock.or(config.num_lock),
+ caps_lock: caps_lock.or(config.caps_lock),
+ scroll_lock: scroll_lock.or(config.scroll_lock),
user_password: otp_pin.unwrap_or(config.user_password),
};
device