From 210688d91392cb90d939dc230316ca54b12eedcf Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 16 Sep 2017 19:41:52 +0200 Subject: [PATCH] Transform UI to use positional args --- bin/core/imag-tag/src/main.rs | 10 +++++----- bin/core/imag-tag/src/ui.rs | 15 ++++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/bin/core/imag-tag/src/main.rs b/bin/core/imag-tag/src/main.rs index 3e03dfd8..55643fcd 100644 --- a/bin/core/imag-tag/src/main.rs +++ b/bin/core/imag-tag/src/main.rs @@ -270,7 +270,7 @@ mod tests { fn test_tag_add_adds_tag() { setup_logging(); debug!("Generating runtime"); - let rt = generate_test_runtime(vec!["--id", "test", "--add", "foo"]).unwrap(); + let rt = generate_test_runtime(vec!["test", "--add", "foo"]).unwrap(); debug!("Creating default entry"); create_test_default_entry(&rt, "test").unwrap(); @@ -299,7 +299,7 @@ mod tests { fn test_tag_add_more_than_remove_adds_tags() { setup_logging(); debug!("Generating runtime"); - let rt = generate_test_runtime(vec!["--id", "test", + let rt = generate_test_runtime(vec!["test", "--add", "foo", "--add", "bar", "--add", "baz", @@ -334,7 +334,7 @@ mod tests { fn test_tag_remove_removes_tag() { setup_logging(); debug!("Generating runtime"); - let rt = generate_test_runtime(vec!["--id", "test", "--remove", "foo"]).unwrap(); + let rt = generate_test_runtime(vec!["test", "--remove", "foo"]).unwrap(); debug!("Creating default entry"); create_test_default_entry(&rt, "test").unwrap(); @@ -361,7 +361,7 @@ mod tests { fn test_tag_remove_removes_only_to_remove_tag() { setup_logging(); debug!("Generating runtime"); - let rt = generate_test_runtime(vec!["--id", "test", "--remove", "foo"]).unwrap(); + let rt = generate_test_runtime(vec!["test", "--remove", "foo"]).unwrap(); debug!("Creating default entry"); create_test_default_entry(&rt, "test").unwrap(); @@ -388,7 +388,7 @@ mod tests { fn test_tag_remove_removes_but_doesnt_crash_on_nonexistent_tag() { setup_logging(); debug!("Generating runtime"); - let rt = generate_test_runtime(vec!["--id", "test", "--remove", "foo", "--remove", "bar"]).unwrap(); + let rt = generate_test_runtime(vec!["test", "--remove", "foo", "--remove", "bar"]).unwrap(); debug!("Creating default entry"); create_test_default_entry(&rt, "test").unwrap(); diff --git a/bin/core/imag-tag/src/ui.rs b/bin/core/imag-tag/src/ui.rs index e8caa492..2883f490 100644 --- a/bin/core/imag-tag/src/ui.rs +++ b/bin/core/imag-tag/src/ui.rs @@ -23,12 +23,12 @@ use libimagentrytag::tag::is_tag; pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { app.arg(Arg::with_name("id") - .long("id") - .short("i") + .index(1) .takes_value(true) .required(true) - .help("Use this entry") - .value_name("ID")) + .multiple(false) + .value_name("ID") + .help("Entry to use")) .arg(Arg::with_name("add-tags") .short("a") @@ -37,15 +37,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .value_name("tags") .multiple(true) .validator(is_tag) - .help("Add tags, seperated by comma or by specifying multiple times")) + .help("Add these tags")) + .arg(Arg::with_name("remove-tags") .short("r") .long("remove") .takes_value(true) - .value_name("tags") .multiple(true) .validator(is_tag) - .help("Remove tags, seperated by comma or by specifying multiple times")) + .value_name("tags") + .help("Remove these tags")) .subcommand(SubCommand::with_name("list") .about("List tags (default)")