Merge pull request #1078 from matthiasbeyer/imag-tag/positional-args

Transform UI to use positional args
This commit is contained in:
Matthias Beyer 2017-09-17 09:48:30 +02:00 committed by GitHub
commit d97b77c30c
2 changed files with 13 additions and 12 deletions

View file

@ -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();

View file

@ -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)")