aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/rbw/main.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2020-04-19 20:26:35 -0400
committerJesse Luehrs <doy@tozt.net>2020-04-19 20:26:35 -0400
commit44f0f76c906d3fabe592958c208c0782a1d9305a (patch)
tree55079205aafcfcc3fdcaae7eb1323bc042b93a2f /src/bin/rbw/main.rs
parentca2f934b014a733121d57475e793e0dad53f7aa9 (diff)
downloadrbw-44f0f76c906d3fabe592958c208c0782a1d9305a.tar.gz
rbw-44f0f76c906d3fabe592958c208c0782a1d9305a.zip
allow creating entries with associated uris
Diffstat (limited to 'src/bin/rbw/main.rs')
-rw-r--r--src/bin/rbw/main.rs26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/bin/rbw/main.rs b/src/bin/rbw/main.rs
index 31f7fd0..051a7bc 100644
--- a/src/bin/rbw/main.rs
+++ b/src/bin/rbw/main.rs
@@ -36,13 +36,29 @@ fn main() {
.subcommand(
clap::SubCommand::with_name("add")
.arg(clap::Arg::with_name("name").required(true))
- .arg(clap::Arg::with_name("user")),
+ .arg(clap::Arg::with_name("user"))
+ .arg(
+ clap::Arg::with_name("uri")
+ .long("uri")
+ .takes_value(true)
+ .multiple(true)
+ .number_of_values(1)
+ .use_delimiter(false),
+ ),
)
.subcommand(
clap::SubCommand::with_name("generate")
.arg(clap::Arg::with_name("len").required(true))
.arg(clap::Arg::with_name("name"))
.arg(clap::Arg::with_name("user"))
+ .arg(
+ clap::Arg::with_name("uri")
+ .long("uri")
+ .takes_value(true)
+ .multiple(true)
+ .number_of_values(1)
+ .use_delimiter(false),
+ )
.arg(clap::Arg::with_name("no-symbols").long("no-symbols"))
.arg(
clap::Arg::with_name("only-numbers").long("only-numbers"),
@@ -111,6 +127,10 @@ fn main() {
("add", Some(smatches)) => commands::add(
smatches.value_of("name").unwrap(),
smatches.value_of("user"),
+ smatches
+ .values_of("uri")
+ .map(|it| it.collect())
+ .unwrap_or_else(|| vec![]),
)
.context("add"),
("generate", Some(smatches)) => {
@@ -131,6 +151,10 @@ fn main() {
Ok(len) => commands::generate(
smatches.value_of("name"),
smatches.value_of("user"),
+ smatches
+ .values_of("uri")
+ .map(|it| it.collect())
+ .unwrap_or_else(|| vec![]),
len,
ty,
)