diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-04-18 01:30:32 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-04-18 01:58:08 -0400 |
commit | 840f53b84206f9efe0a5cdea3414c472908a22e4 (patch) | |
tree | e8d95614a3f0c1ae1bfd4c9616ce6143cc3e6e0b /src/bin/rbw/main.rs | |
parent | dd7ef574e84ca6c1a548422904c6865048ae8e30 (diff) | |
download | rbw-840f53b84206f9efe0a5cdea3414c472908a22e4.tar.gz rbw-840f53b84206f9efe0a5cdea3414c472908a22e4.zip |
implement add command
Diffstat (limited to 'src/bin/rbw/main.rs')
-rw-r--r-- | src/bin/rbw/main.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bin/rbw/main.rs b/src/bin/rbw/main.rs index 1260edf..136322a 100644 --- a/src/bin/rbw/main.rs +++ b/src/bin/rbw/main.rs @@ -27,7 +27,11 @@ fn main() { .arg(clap::Arg::with_name("name").required(true)) .arg(clap::Arg::with_name("user")), ) - .subcommand(clap::SubCommand::with_name("add")) + .subcommand( + clap::SubCommand::with_name("add") + .arg(clap::Arg::with_name("name").required(true)) + .arg(clap::Arg::with_name("user").required(true)), + ) .subcommand( clap::SubCommand::with_name("generate") .arg(clap::Arg::with_name("len").required(true)) @@ -83,7 +87,12 @@ fn main() { smatches.value_of("user"), ) .context("get"), - ("add", Some(_)) => commands::add().context("add"), + // this unwrap is safe because name is marked .required(true) + ("add", Some(smatches)) => commands::add( + smatches.value_of("name").unwrap(), + smatches.value_of("user"), + ) + .context("add"), ("generate", Some(smatches)) => { let ty = if smatches.is_present("no-symbols") { rbw::pwgen::Type::NoSymbols |