2016-02-13 19:25:11 +00:00
|
|
|
use clap::{Arg, App, SubCommand};
|
|
|
|
|
|
|
|
pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
|
|
|
app
|
|
|
|
.arg(Arg::with_name("increment")
|
|
|
|
.long("inc")
|
|
|
|
.short("i")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("Increment a counter")
|
|
|
|
.value_name("COUNTER"))
|
2016-02-13 19:25:11 +00:00
|
|
|
|
|
|
|
.arg(Arg::with_name("decrement")
|
|
|
|
.long("dec")
|
|
|
|
.short("d")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("Decrement a counter")
|
|
|
|
.value_name("COUNTER"))
|
2016-02-13 19:25:11 +00:00
|
|
|
|
|
|
|
.arg(Arg::with_name("reset")
|
|
|
|
.long("reset")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("Reset a counter")
|
|
|
|
.value_name("COUNTER"))
|
2016-02-13 19:25:11 +00:00
|
|
|
|
|
|
|
.arg(Arg::with_name("set")
|
|
|
|
.long("set")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("Set a counter")
|
|
|
|
.value_name("COUNTER"))
|
2016-02-13 19:25:11 +00:00
|
|
|
|
|
|
|
.subcommand(SubCommand::with_name("create")
|
|
|
|
.about("Create a counter")
|
|
|
|
.version("0.1")
|
|
|
|
.arg(Arg::with_name("name")
|
|
|
|
.long("name")
|
|
|
|
.short("n")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(true)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("Create counter with this name")
|
|
|
|
.value_name("NAME"))
|
2016-02-13 19:25:11 +00:00
|
|
|
.arg(Arg::with_name("initval")
|
|
|
|
.long("init")
|
|
|
|
.short("i")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("Initial value")
|
|
|
|
.value_name("VALUE")))
|
2016-02-13 19:25:11 +00:00
|
|
|
|
|
|
|
.subcommand(SubCommand::with_name("delete")
|
|
|
|
.about("Delete a counter")
|
|
|
|
.version("0.1")
|
|
|
|
.arg(Arg::with_name("name")
|
|
|
|
.long("name")
|
|
|
|
.short("n")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(true)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("Create counter with this name")
|
|
|
|
.value_name("NAME")))
|
2016-02-13 19:25:11 +00:00
|
|
|
|
2016-03-10 19:27:21 +00:00
|
|
|
.subcommand(SubCommand::with_name("list")
|
|
|
|
.about("List counters")
|
|
|
|
.version("0.1")
|
|
|
|
.arg(Arg::with_name("name")
|
|
|
|
.long("name")
|
|
|
|
.short("n")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("List counters with this name (foo/bar and baz/bar would match 'bar')")
|
|
|
|
.value_name("NAME"))
|
2016-03-10 19:27:21 +00:00
|
|
|
|
|
|
|
.arg(Arg::with_name("greater-than")
|
|
|
|
.long("greater")
|
|
|
|
.short("g")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("List counters which are greater than VALUE")
|
|
|
|
.value_name("VALUE"))
|
2016-03-10 19:27:21 +00:00
|
|
|
|
|
|
|
.arg(Arg::with_name("lower-than")
|
|
|
|
.long("lower")
|
|
|
|
.short("l")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("List counters which are lower than VALUE")
|
|
|
|
.value_name("VALUE"))
|
2016-03-10 19:27:21 +00:00
|
|
|
|
|
|
|
.arg(Arg::with_name("equals")
|
|
|
|
.long("equal")
|
|
|
|
.short("e")
|
|
|
|
.takes_value(true)
|
|
|
|
.required(false)
|
2016-06-08 12:11:13 +00:00
|
|
|
.help("List counters which equal VALUE")
|
|
|
|
.value_name("VALUE"))
|
2016-03-10 19:27:21 +00:00
|
|
|
)
|
|
|
|
|
2016-02-28 11:26:16 +00:00
|
|
|
.subcommand(SubCommand::with_name("interactive")
|
|
|
|
.about("Interactively count things")
|
|
|
|
.version("0.1")
|
|
|
|
.arg(Arg::with_name("spec")
|
|
|
|
.long("spec")
|
|
|
|
.short("s")
|
|
|
|
.takes_value(true)
|
|
|
|
.multiple(true)
|
|
|
|
.required(true)
|
|
|
|
.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
|
2016-06-08 12:11:13 +00:00
|
|
|
to.")
|
|
|
|
.value_name("KEY=VALUE")))
|
2016-02-28 11:26:16 +00:00
|
|
|
}
|