From 2feed7e2e9367c935aeb669daab66a63cff2f6c0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 3 May 2020 16:01:26 -0400 Subject: add command to clear a config setting --- src/bin/rbw/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/bin/rbw/main.rs') 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); -- cgit v1.2.3-54-g00ecf