aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/rbw/main.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-04-18 05:18:45 -0400
committerJesse Luehrs <doy@tozt.net>2020-04-18 05:18:45 -0400
commit50ab8aabcec26d07f4b4d9652dbceac1b89a6b22 (patch)
treeeadd12b800d47e721f0941d39a6826dbdb4d6353 /src/bin/rbw/main.rs
parent017f1b04df0701e21e7cb44e3e4f6fc505d95638 (diff)
downloadrbw-50ab8aabcec26d07f4b4d9652dbceac1b89a6b22.tar.gz
rbw-50ab8aabcec26d07f4b4d9652dbceac1b89a6b22.zip
implement edit command
Diffstat (limited to 'src/bin/rbw/main.rs')
-rw-r--r--src/bin/rbw/main.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/bin/rbw/main.rs b/src/bin/rbw/main.rs
index 5bd6032..b09ae2b 100644
--- a/src/bin/rbw/main.rs
+++ b/src/bin/rbw/main.rs
@@ -58,7 +58,11 @@ fn main() {
"diceware",
])),
)
- .subcommand(clap::SubCommand::with_name("edit"))
+ .subcommand(
+ clap::SubCommand::with_name("edit")
+ .arg(clap::Arg::with_name("name").required(true))
+ .arg(clap::Arg::with_name("user")),
+ )
.subcommand(
clap::SubCommand::with_name("remove")
.arg(clap::Arg::with_name("name").required(true))
@@ -127,7 +131,12 @@ fn main() {
Err(e) => Err(e.into()),
}
}
- ("edit", Some(_)) => commands::edit().context("edit"),
+ // this unwrap is safe because name is marked .required(true)
+ ("edit", Some(smatches)) => commands::edit(
+ smatches.value_of("name").unwrap(),
+ smatches.value_of("user"),
+ )
+ .context("edit"),
// this unwrap is safe because name is marked .required(true)
("remove", Some(smatches)) => commands::remove(
smatches.value_of("name").unwrap(),