diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-05-03 16:01:26 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-05-03 16:02:53 -0400 |
commit | 2feed7e2e9367c935aeb669daab66a63cff2f6c0 (patch) | |
tree | 17c20ca1a762c2bb2a017506dfdc1cda30a9c25b /src/bin/rbw/main.rs | |
parent | fbd23df0526996a6745895e8e5f2266f88e75e7e (diff) | |
download | rbw-2feed7e2e9367c935aeb669daab66a63cff2f6c0.tar.gz rbw-2feed7e2e9367c935aeb669daab66a63cff2f6c0.zip |
add command to clear a config setting
Diffstat (limited to 'src/bin/rbw/main.rs')
-rw-r--r-- | src/bin/rbw/main.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bin/rbw/main.rs b/src/bin/rbw/main.rs index f763fe9..e2f2e85 100644 --- a/src/bin/rbw/main.rs +++ b/src/bin/rbw/main.rs @@ -37,6 +37,15 @@ fn main() { "Value to set the configuration option to", ), ), + ) + .subcommand( + clap::SubCommand::with_name("unset") + .about("Reset a configuration option to its default") + .arg( + clap::Arg::with_name("key") + .required(true) + .help("Configuration key to unset"), + ), ), ) .subcommand( @@ -271,6 +280,11 @@ fn main() { ssmatches.value_of("value").unwrap(), ) .context("config set"), + // this unwrap is fine because key is marked .required(true) + ("unset", Some(ssmatches)) => { + commands::config_unset(ssmatches.value_of("key").unwrap()) + .context("config unset") + } _ => { eprintln!("{}", smatches.usage()); std::process::exit(1); |