summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-09-17 09:48:30 +0200
committerGitHub <noreply@github.com>2017-09-17 09:48:30 +0200
commitd97b77c30ccddbb4b3e74b4a4962fbbe216b2192 (patch)
treed6e6201fa5538397f8e5068cc0f8ae1d07888e47
parent2c02c98230bbf6e9f6a659e8a7c64f0c92fd88b1 (diff)
parent210688d91392cb90d939dc230316ca54b12eedcf (diff)
downloadimag-d97b77c30ccddbb4b3e74b4a4962fbbe216b2192.zip
imag-d97b77c30ccddbb4b3e74b4a4962fbbe216b2192.tar.gz
Merge pull request #1078 from matthiasbeyer/imag-tag/positional-args
Transform UI to use positional args
-rw-r--r--bin/core/imag-tag/src/main.rs10
-rw-r--r--bin/core/imag-tag/src/ui.rs15
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 3e03dfd..55643fc 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 e8caa49..2883f49 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)")