Merge pull request #466 from matthiasbeyer/binary-enhance-ui

Binary enhance ui
This commit is contained in:
Matthias Beyer 2016-06-08 16:39:22 +02:00
commit 34d702ea83
7 changed files with 87 additions and 51 deletions

View file

@ -7,26 +7,30 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("i") .short("i")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Increment a counter")) .help("Increment a counter")
.value_name("COUNTER"))
.arg(Arg::with_name("decrement") .arg(Arg::with_name("decrement")
.long("dec") .long("dec")
.short("d") .short("d")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Decrement a counter")) .help("Decrement a counter")
.value_name("COUNTER"))
.arg(Arg::with_name("reset") .arg(Arg::with_name("reset")
.long("reset") .long("reset")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Reset a counter")) .help("Reset a counter")
.value_name("COUNTER"))
.arg(Arg::with_name("set") .arg(Arg::with_name("set")
.long("set") .long("set")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Set a counter")) .help("Set a counter")
.value_name("COUNTER"))
.subcommand(SubCommand::with_name("create") .subcommand(SubCommand::with_name("create")
.about("Create a counter") .about("Create a counter")
@ -36,13 +40,15 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("n") .short("n")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Create counter with this name")) .help("Create counter with this name")
.value_name("NAME"))
.arg(Arg::with_name("initval") .arg(Arg::with_name("initval")
.long("init") .long("init")
.short("i") .short("i")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Initial value"))) .help("Initial value")
.value_name("VALUE")))
.subcommand(SubCommand::with_name("delete") .subcommand(SubCommand::with_name("delete")
.about("Delete a counter") .about("Delete a counter")
@ -52,7 +58,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("n") .short("n")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Create counter with this name"))) .help("Create counter with this name")
.value_name("NAME")))
.subcommand(SubCommand::with_name("list") .subcommand(SubCommand::with_name("list")
.about("List counters") .about("List counters")
@ -62,28 +69,32 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("n") .short("n")
.takes_value(true) .takes_value(true)
.required(false) .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") .arg(Arg::with_name("greater-than")
.long("greater") .long("greater")
.short("g") .short("g")
.takes_value(true) .takes_value(true)
.required(false) .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") .arg(Arg::with_name("lower-than")
.long("lower") .long("lower")
.short("l") .short("l")
.takes_value(true) .takes_value(true)
.required(false) .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") .arg(Arg::with_name("equals")
.long("equal") .long("equal")
.short("e") .short("e")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("List counters which equal VALUE")) .help("List counters which equal VALUE")
.value_name("VALUE"))
) )
.subcommand(SubCommand::with_name("interactive") .subcommand(SubCommand::with_name("interactive")
@ -97,6 +108,6 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.required(true) .required(true)
.help("Specification for key-bindings. Use <KEY>=<VALUE> where KEY is the .help("Specification for key-bindings. Use <KEY>=<VALUE> where KEY is the
key to bind (single character) and VALUE is the path to the counter to bind key to bind (single character) and VALUE is the path to the counter to bind
to."))) to.")
.value_name("KEY=VALUE")))
} }

View file

@ -13,14 +13,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("f") .short("f")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Link from this entry")) .help("Link from this entry")
.value_name("ENTRY"))
.arg(Arg::with_name("to") .arg(Arg::with_name("to")
.long("to") .long("to")
.short("t") .short("t")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.multiple(true) .multiple(true)
.help("Link to this entries")) .help("Link to this entries")
.value_name("ENTRIES"))
) )
.subcommand(SubCommand::with_name("remove") .subcommand(SubCommand::with_name("remove")
@ -31,14 +33,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("f") .short("f")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Remove Link from this entry")) .help("Remove Link from this entry")
.value_name("ENTRY"))
.arg(Arg::with_name("to") .arg(Arg::with_name("to")
.long("to") .long("to")
.short("t") .short("t")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.multiple(true) .multiple(true)
.help("Remove links to these entries")) .help("Remove links to these entries")
.value_name("ENTRIES"))
) )
.arg(Arg::with_name("list") .arg(Arg::with_name("list")
@ -46,7 +50,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("l") .short("l")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("List links to this entry")) .help("List links to this entry")
.value_name("ENTRY"))
) )
.subcommand(SubCommand::with_name("external") .subcommand(SubCommand::with_name("external")
.about("Add and remove external links") .about("Add and remove external links")
@ -57,14 +62,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("i") .short("i")
.takes_value(true) .takes_value(true)
.required(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") .arg(Arg::with_name("add")
.long("add") .long("add")
.short("a") .short("a")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Add this URI as external link")) .help("Add this URI as external link")
.value_name("URI"))
.arg(Arg::with_name("remove") .arg(Arg::with_name("remove")
.long("remove") .long("remove")
@ -78,7 +85,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("s") .short("s")
.takes_value(true) .takes_value(true)
.required(false) .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") .arg(Arg::with_name("list")
.long("list") .long("list")
@ -93,4 +101,3 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
) )
} }

View file

@ -13,7 +13,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("n") .short("n")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Create Note with this name")) .help("Create Note with this name")
.value_name("NAME"))
.arg(Arg::with_name("edit") .arg(Arg::with_name("edit")
.long("edit") .long("edit")
.short("e") .short("e")
@ -30,7 +31,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("n") .short("n")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Delete Note with this name"))) .help("Delete Note with this name")
.value_name("NAME")))
.subcommand(SubCommand::with_name("edit") .subcommand(SubCommand::with_name("edit")
.about("Edit a Note") .about("Edit a Note")
@ -40,7 +42,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("n") .short("n")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Edit Note with this name")) .help("Edit Note with this name")
.value_name("NAME"))
.arg(tag_argument()) .arg(tag_argument())
.group(ArgGroup::with_name("editargs") .group(ArgGroup::with_name("editargs")
@ -53,5 +56,3 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.version("0.1")) .version("0.1"))
} }

View file

@ -9,17 +9,20 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("p") .short("p")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Create at this store path")) .help("Create at this store path")
.value_name("PATH"))
.arg(Arg::with_name("id") .arg(Arg::with_name("id")
.long("id") .long("id")
.short("i") .short("i")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Same as --path, for consistency")) .help("Same as --path, for consistency")
.value_name("PATH"))
.arg(Arg::with_name("from-raw") .arg(Arg::with_name("from-raw")
.long("from-raw") .long("from-raw")
.takes_value(true) .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") .group(ArgGroup::with_name("create-destination-group")
.args(&["path", "id"]) .args(&["path", "id"])
@ -32,12 +35,14 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.long("content") .long("content")
.short("c") .short("c")
.takes_value(true) .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") .arg(Arg::with_name("content-from")
.long("content-from") .long("content-from")
.short("f") .short("f")
.takes_value(true) .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") .group(ArgGroup::with_name("create-content-group")
.args(&["content", "content-from"]) .args(&["content", "content-from"])
@ -48,7 +53,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("h") .short("h")
.takes_value(true) .takes_value(true)
.multiple(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") .short("i")
.takes_value(true) .takes_value(true)
.required(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") .arg(Arg::with_name("content")
.long("content") .long("content")
.short("c") .short("c")
@ -129,6 +136,7 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("w") .short("w")
.takes_value(true) .takes_value(true)
.help("Filter with 'header.field=foo' where the header field 'header.field' equals 'foo'") .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") .arg(Arg::with_name("header-field-grep")
.long("grep") .long("grep")
@ -146,12 +154,14 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("i") .short("i")
.takes_value(true) .takes_value(true)
.required(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") .arg(Arg::with_name("content")
.long("content") .long("content")
.short("c") .short("c")
.takes_value(true) .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") .arg(Arg::with_name("header")
.long("header") .long("header")
.short("h") .short("h")
@ -168,7 +178,7 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("i") .short("i")
.takes_value(true) .takes_value(true)
.required(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"))
) )
} }

View file

@ -8,7 +8,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("i") .short("i")
.takes_value(true) .takes_value(true)
.required(true) .required(true)
.help("Use this entry")) .help("Use this entry")
.value_name("ID"))
.arg(tag_add_arg()) .arg(tag_add_arg())
.arg(tag_remove_arg()) .arg(tag_remove_arg())
@ -39,7 +40,8 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("s") .short("s")
.takes_value(true) .takes_value(true)
.required(false) .required(false)
.help("Seperated by string")) .help("Separated by string")
.value_name("SEP"))
.group(ArgGroup::with_name("list-group") .group(ArgGroup::with_name("list-group")
.args(&[ .args(&[
@ -52,5 +54,3 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
) )
} }

View file

@ -7,14 +7,16 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("i") .short("i")
.takes_value(true) .takes_value(true)
.required(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") .arg(Arg::with_name("version")
.long("version") .long("version")
.short("V") .short("V")
.takes_value(true) .takes_value(true)
.required(false) .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") .arg(Arg::with_name("versions")
.long("versions") .long("versions")
@ -71,21 +73,24 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("b") .short("b")
.takes_value(true) // optional, which browser .takes_value(true) // optional, which browser
.required(false) .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") .arg(Arg::with_name("view-in-texteditor")
.long("editor") .long("editor")
.short("e") .short("e")
.takes_value(true) // optional, which editor .takes_value(true) // optional, which editor
.required(false) .required(false)
.help("View content in $EDITOR")) .help("View content in $EDITOR")
.value_name("EDITOR"))
.arg(Arg::with_name("view-in-custom") .arg(Arg::with_name("view-in-custom")
.long("custom") .long("custom")
.short("c") .short("c")
.takes_value(true) // non-optional, call-string .takes_value(true) // non-optional, call-string
.required(false) .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") .group(ArgGroup::with_name("viewer")
.args(&["view-in-stdout", .args(&["view-in-stdout",
@ -105,15 +110,15 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.short("f") .short("f")
.takes_value(true) // "markdown" or "textile" or "restructuredtex" .takes_value(true) // "markdown" or "textile" or "restructuredtex"
.required(true) .required(true)
.help("Compile from")) .help("Compile from")
.value_name("FORMAT"))
.arg(Arg::with_name("to") .arg(Arg::with_name("to")
.long("to") .long("to")
.short("t") .short("t")
.takes_value(true) // "html" or "HTML" or ... json maybe? .takes_value(true) // "html" or "HTML" or ... json maybe?
.required(true) .required(true)
.help("Compile to")) .help("Compile to")
.value_name("FORMAT"))
) )
} }

View file

@ -18,6 +18,7 @@ pub fn tag_add_arg<'a, 'b>() -> Arg<'a, 'b> {
.short("a") .short("a")
.long("add") .long("add")
.takes_value(true) .takes_value(true)
.value_name("tags")
.multiple(true) .multiple(true)
.help("Add tags, seperated by comma or by specifying multiple times") .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") .short("r")
.long("remove") .long("remove")
.takes_value(true) .takes_value(true)
.value_name("tags")
.multiple(true) .multiple(true)
.help("Remove tags, seperated by comma or by specifying multiple times") .help("Remove tags, seperated by comma or by specifying multiple times")
} }