From 6a8a8150fdc91ab956bb5c08cae9428df211129f Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 8 Jun 2016 14:11:13 +0200 Subject: [PATCH 1/7] Add value_name() call in ui specification code --- imag-counter/src/ui.rs | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/imag-counter/src/ui.rs b/imag-counter/src/ui.rs index 2e6d18ef..b942498d 100644 --- a/imag-counter/src/ui.rs +++ b/imag-counter/src/ui.rs @@ -7,26 +7,30 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("i") .takes_value(true) .required(false) - .help("Increment a counter")) + .help("Increment a counter") + .value_name("COUNTER")) .arg(Arg::with_name("decrement") .long("dec") .short("d") .takes_value(true) .required(false) - .help("Decrement a counter")) + .help("Decrement a counter") + .value_name("COUNTER")) .arg(Arg::with_name("reset") .long("reset") .takes_value(true) .required(false) - .help("Reset a counter")) + .help("Reset a counter") + .value_name("COUNTER")) .arg(Arg::with_name("set") .long("set") .takes_value(true) .required(false) - .help("Set a counter")) + .help("Set a counter") + .value_name("COUNTER")) .subcommand(SubCommand::with_name("create") .about("Create a counter") @@ -36,13 +40,15 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("n") .takes_value(true) .required(true) - .help("Create counter with this name")) + .help("Create counter with this name") + .value_name("NAME")) .arg(Arg::with_name("initval") .long("init") .short("i") .takes_value(true) .required(false) - .help("Initial value"))) + .help("Initial value") + .value_name("VALUE"))) .subcommand(SubCommand::with_name("delete") .about("Delete a counter") @@ -52,7 +58,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("n") .takes_value(true) .required(true) - .help("Create counter with this name"))) + .help("Create counter with this name") + .value_name("NAME"))) .subcommand(SubCommand::with_name("list") .about("List counters") @@ -62,28 +69,32 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("n") .takes_value(true) .required(false) - .help("List counters with this name (foo/bar and baz/bar would match 'bar')")) + .help("List counters with this name (foo/bar and baz/bar would match 'bar')") + .value_name("NAME")) .arg(Arg::with_name("greater-than") .long("greater") .short("g") .takes_value(true) .required(false) - .help("List counters which are greater than VALUE")) + .help("List counters which are greater than VALUE") + .value_name("VALUE")) .arg(Arg::with_name("lower-than") .long("lower") .short("l") .takes_value(true) .required(false) - .help("List counters which are lower than VALUE")) + .help("List counters which are lower than VALUE") + .value_name("VALUE")) .arg(Arg::with_name("equals") .long("equal") .short("e") .takes_value(true) .required(false) - .help("List counters which equal VALUE")) + .help("List counters which equal VALUE") + .value_name("VALUE")) ) .subcommand(SubCommand::with_name("interactive") @@ -97,6 +108,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .required(true) .help("Specification for key-bindings. Use = where KEY is the key to bind (single character) and VALUE is the path to the counter to bind - to."))) + to.") + .value_name("KEY=VALUE"))) } - From 7d395dd87a89dbb8de88524ba866a4ea7e8033e0 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 8 Jun 2016 14:11:13 +0200 Subject: [PATCH 2/7] Add value_name() call in ui specification code --- imag-link/src/ui.rs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/imag-link/src/ui.rs b/imag-link/src/ui.rs index 95881a58..b54c4982 100644 --- a/imag-link/src/ui.rs +++ b/imag-link/src/ui.rs @@ -13,14 +13,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("f") .takes_value(true) .required(true) - .help("Link from this entry")) + .help("Link from this entry") + .value_name("ENTRY")) .arg(Arg::with_name("to") .long("to") .short("t") .takes_value(true) .required(true) .multiple(true) - .help("Link to this entries")) + .help("Link to this entries") + .value_name("ENTRIES")) ) .subcommand(SubCommand::with_name("remove") @@ -31,14 +33,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("f") .takes_value(true) .required(true) - .help("Remove Link from this entry")) + .help("Remove Link from this entry") + .value_name("ENTRY")) .arg(Arg::with_name("to") .long("to") .short("t") .takes_value(true) .required(true) .multiple(true) - .help("Remove links to these entries")) + .help("Remove links to these entries") + .value_name("ENTRIES")) ) .arg(Arg::with_name("list") @@ -46,7 +50,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("l") .takes_value(true) .required(false) - .help("List links to this entry")) + .help("List links to this entry") + .value_name("ENTRY")) ) .subcommand(SubCommand::with_name("external") .about("Add and remove external links") @@ -57,14 +62,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("i") .takes_value(true) .required(true) - .help("Modify external link of this entry")) + .help("Modify external link of this entry") + .value_name("ENTRY")) .arg(Arg::with_name("add") .long("add") .short("a") .takes_value(true) .required(false) - .help("Add this URI as external link")) + .help("Add this URI as external link") + .value_name("URI")) .arg(Arg::with_name("remove") .long("remove") @@ -78,7 +85,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("s") .takes_value(true) .required(false) - .help("Set these URIs as external link (seperate by comma)")) + .help("Set these URIs as external link (seperate by comma)") + .value_name("URIs")) .arg(Arg::with_name("list") .long("list") @@ -93,4 +101,3 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { ) } - From 91f1e46282d31e0019e135c68676217aac436084 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 8 Jun 2016 14:11:13 +0200 Subject: [PATCH 3/7] Add value_name() call in ui specification code --- imag-notes/src/ui.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/imag-notes/src/ui.rs b/imag-notes/src/ui.rs index bf2047d7..6b3b099f 100644 --- a/imag-notes/src/ui.rs +++ b/imag-notes/src/ui.rs @@ -13,7 +13,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("n") .takes_value(true) .required(true) - .help("Create Note with this name")) + .help("Create Note with this name") + .value_name("NAME")) .arg(Arg::with_name("edit") .long("edit") .short("e") @@ -30,7 +31,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("n") .takes_value(true) .required(true) - .help("Delete Note with this name"))) + .help("Delete Note with this name") + .value_name("NAME"))) .subcommand(SubCommand::with_name("edit") .about("Edit a Note") @@ -40,7 +42,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("n") .takes_value(true) .required(true) - .help("Edit Note with this name")) + .help("Edit Note with this name") + .value_name("NAME")) .arg(tag_argument()) .group(ArgGroup::with_name("editargs") @@ -53,5 +56,3 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .version("0.1")) } - - From 0ca8f6bc0b7284f70062600934c18430ea9be0b6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 8 Jun 2016 14:11:13 +0200 Subject: [PATCH 4/7] Add value_name() call in ui specification code --- imag-store/src/ui.rs | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/imag-store/src/ui.rs b/imag-store/src/ui.rs index e9ccb7e4..220c8433 100644 --- a/imag-store/src/ui.rs +++ b/imag-store/src/ui.rs @@ -9,17 +9,20 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("p") .takes_value(true) .required(false) - .help("Create at this store path")) + .help("Create at this store path") + .value_name("PATH")) .arg(Arg::with_name("id") .long("id") .short("i") .takes_value(true) .required(false) - .help("Same as --path, for consistency")) + .help("Same as --path, for consistency") + .value_name("PATH")) .arg(Arg::with_name("from-raw") .long("from-raw") .takes_value(true) - .help("Create a new entry by reading this file ('-' for stdin)")) + .help("Create a new entry by reading this file ('-' for stdin)") + .value_name("FILE")) .group(ArgGroup::with_name("create-destination-group") .args(&["path", "id"]) @@ -32,12 +35,14 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .long("content") .short("c") .takes_value(true) - .help("Content for the Entry from commandline")) + .help("Content for the Entry from commandline") + .value_name("CONTENT")) .arg(Arg::with_name("content-from") .long("content-from") .short("f") .takes_value(true) - .help("Content for the Entry from this file ('-' for stdin)")) + .help("Content for the Entry from this file ('-' for stdin)") + .value_name("CONTENT")) .group(ArgGroup::with_name("create-content-group") .args(&["content", "content-from"]) @@ -48,7 +53,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("h") .takes_value(true) .multiple(true) - .help("Set a header field. Specify as 'header.field.value=value', multiple allowed")) + .help("Set a header field. Specify as 'header.field.value=value', multiple allowed") + .value_name("header.field.value=value")) ) ) @@ -103,7 +109,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("i") .takes_value(true) .required(true) - .help("Retreive by Store Path, where root (/) is the store itself")) + .help("Retrieve by Store Path, where root (/) is the store itself") + .value_name("PATH")) .arg(Arg::with_name("content") .long("content") .short("c") @@ -129,6 +136,7 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("w") .takes_value(true) .help("Filter with 'header.field=foo' where the header field 'header.field' equals 'foo'") + .value_name("header.field=foo") ) .arg(Arg::with_name("header-field-grep") .long("grep") @@ -146,12 +154,14 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("i") .takes_value(true) .required(true) - .help("Update Store Entry with this path. Root (/) is the store itself")) + .help("Update Store Entry with this path. Root (/) is the store itself") + .value_name("PATH")) .arg(Arg::with_name("content") .long("content") .short("c") .takes_value(true) - .help("Take the content for the new Entry from this file ('-' for stdin)")) + .help("Take the content for the new Entry from this file ('-' for stdin)") + .value_name("CONTENT")) .arg(Arg::with_name("header") .long("header") .short("h") @@ -168,7 +178,7 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("i") .takes_value(true) .required(true) - .help("Remove Store Entry with this path. Root (/) is the store itself")) + .help("Remove Store Entry with this path. Root (/) is the store itself") + .value_name("PATH")) ) } - From 807f734d383b2983ac6885c1cbd461ee2fea66e1 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 8 Jun 2016 14:11:13 +0200 Subject: [PATCH 5/7] Add value_name() call in ui specification code --- imag-tag/src/ui.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/imag-tag/src/ui.rs b/imag-tag/src/ui.rs index 32e3383c..1355344a 100644 --- a/imag-tag/src/ui.rs +++ b/imag-tag/src/ui.rs @@ -8,7 +8,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("i") .takes_value(true) .required(true) - .help("Use this entry")) + .help("Use this entry") + .value_name("ID")) .arg(tag_add_arg()) .arg(tag_remove_arg()) @@ -39,7 +40,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("s") .takes_value(true) .required(false) - .help("Seperated by string")) + .help("Separated by string") + .value_name("SEP")) .group(ArgGroup::with_name("list-group") .args(&[ @@ -52,5 +54,3 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { ) } - - From 4e987e32cf157d8c26bb0514b05a2e5464741cca Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 8 Jun 2016 14:11:13 +0200 Subject: [PATCH 6/7] Add value_name() call in ui specification code --- imag-view/src/ui.rs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/imag-view/src/ui.rs b/imag-view/src/ui.rs index 619e4f27..54979f1f 100644 --- a/imag-view/src/ui.rs +++ b/imag-view/src/ui.rs @@ -7,14 +7,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("i") .takes_value(true) .required(true) - .help("View this entry at this store path")) + .help("View this entry at this store path") + .value_name("ID")) .arg(Arg::with_name("version") .long("version") .short("V") .takes_value(true) .required(false) - .help("View this version (youngest if not specified)")) + .help("View this version (youngest if not specified)") + .value_name("VERSION")) .arg(Arg::with_name("versions") .long("versions") @@ -71,21 +73,24 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("b") .takes_value(true) // optional, which browser .required(false) - .help("View content in $BROWSER (fails if no env variable $BROWSER)")) + .help("View content in $BROWSER (fails if no env variable $BROWSER)") + .value_name("BROWSER")) .arg(Arg::with_name("view-in-texteditor") .long("editor") .short("e") .takes_value(true) // optional, which editor .required(false) - .help("View content in $EDITOR")) + .help("View content in $EDITOR") + .value_name("EDITOR")) .arg(Arg::with_name("view-in-custom") .long("custom") .short("c") .takes_value(true) // non-optional, call-string .required(false) - .help("View content in custom program, for example 'libreoffice %e', replace '%e' with entry path")) + .help("View content in custom program, for example 'libreoffice %e', replace '%e' with entry path") + .value_name("PROGRAM")) .group(ArgGroup::with_name("viewer") .args(&["view-in-stdout", @@ -105,15 +110,15 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { .short("f") .takes_value(true) // "markdown" or "textile" or "restructuredtex" .required(true) - .help("Compile from")) + .help("Compile from") + .value_name("FORMAT")) .arg(Arg::with_name("to") .long("to") .short("t") .takes_value(true) // "html" or "HTML" or ... json maybe? .required(true) - .help("Compile to")) + .help("Compile to") + .value_name("FORMAT")) ) } - - From e05d0e6f130e179d65933f1ebd3427a649827813 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Wed, 8 Jun 2016 14:10:21 +0200 Subject: [PATCH 7/7] libimagentrytag: Add value_name() call in ui helpers --- libimagentrytag/src/ui.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libimagentrytag/src/ui.rs b/libimagentrytag/src/ui.rs index 29cf8bc8..e74b1ac9 100644 --- a/libimagentrytag/src/ui.rs +++ b/libimagentrytag/src/ui.rs @@ -18,6 +18,7 @@ pub fn tag_add_arg<'a, 'b>() -> Arg<'a, 'b> { .short("a") .long("add") .takes_value(true) + .value_name("tags") .multiple(true) .help("Add tags, seperated by comma or by specifying multiple times") } @@ -27,6 +28,7 @@ pub fn tag_remove_arg<'a, 'b>() -> Arg<'a, 'b> { .short("r") .long("remove") .takes_value(true) + .value_name("tags") .multiple(true) .help("Remove tags, seperated by comma or by specifying multiple times") }