diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-04-18 04:24:26 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-04-18 04:30:04 -0400 |
commit | 3765d4f2edc5933f61fd46ab130e366774556cf5 (patch) | |
tree | 930ce485993d46dd1e13f00fae00930521c0ef39 /src/bin/rbw/main.rs | |
parent | b3c69bf88d973af04433d450a659ef1581d813e2 (diff) | |
download | rbw-3765d4f2edc5933f61fd46ab130e366774556cf5.tar.gz rbw-3765d4f2edc5933f61fd46ab130e366774556cf5.zip |
implement remove
Diffstat (limited to 'src/bin/rbw/main.rs')
-rw-r--r-- | src/bin/rbw/main.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/bin/rbw/main.rs b/src/bin/rbw/main.rs index 136322a..45f1985 100644 --- a/src/bin/rbw/main.rs +++ b/src/bin/rbw/main.rs @@ -30,7 +30,7 @@ fn main() { .subcommand( clap::SubCommand::with_name("add") .arg(clap::Arg::with_name("name").required(true)) - .arg(clap::Arg::with_name("user").required(true)), + .arg(clap::Arg::with_name("user")), ) .subcommand( clap::SubCommand::with_name("generate") @@ -54,7 +54,11 @@ fn main() { ])), ) .subcommand(clap::SubCommand::with_name("edit")) - .subcommand(clap::SubCommand::with_name("remove")) + .subcommand( + clap::SubCommand::with_name("remove") + .arg(clap::Arg::with_name("name").required(true)) + .arg(clap::Arg::with_name("user")), + ) .subcommand(clap::SubCommand::with_name("lock")) .subcommand(clap::SubCommand::with_name("purge")) .subcommand(clap::SubCommand::with_name("stop-agent")) @@ -119,7 +123,12 @@ fn main() { } } ("edit", Some(_)) => commands::edit().context("edit"), - ("remove", Some(_)) => commands::remove().context("remove"), + // this unwrap is safe because name is marked .required(true) + ("remove", Some(smatches)) => commands::remove( + smatches.value_of("name").unwrap(), + smatches.value_of("user"), + ) + .context("remove"), ("lock", Some(_)) => commands::lock().context("lock"), ("purge", Some(_)) => commands::purge().context("purge"), ("stop-agent", Some(_)) => { |