2016-03-19 15:47:56 +00:00
|
|
|
use clap::{Arg, ArgGroup, App, SubCommand};
|
|
|
|
|
2016-04-16 19:58:19 +00:00
|
|
|
use libimagentrytag::ui::tag_argument;
|
|
|
|
use libimagentrytag::ui::tag_argument_name;
|
2016-03-19 15:47:56 +00:00
|
|
|
|
|
|
|
pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
|
|
|
app
|
|
|
|
.subcommand(SubCommand::with_name("create")
|
|
|
|
.about("Create a note")
|
|
|
|
.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 Note with this name")
|
|
|
|
.value_name("NAME"))
|
2016-03-26 15:06:12 +00:00
|
|
|
.arg(Arg::with_name("edit")
|
|
|
|
.long("edit")
|
|
|
|
.short("e")
|
|
|
|
.takes_value(false)
|
|
|
|
.required(false)
|
|
|
|
.help("Edit after creating"))
|
|
|
|
)
|
2016-03-19 15:47:56 +00:00
|
|
|
|
|
|
|
.subcommand(SubCommand::with_name("delete")
|
|
|
|
.about("Delete a Note")
|
|
|
|
.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("Delete Note with this name")
|
|
|
|
.value_name("NAME")))
|
2016-03-19 15:47:56 +00:00
|
|
|
|
|
|
|
.subcommand(SubCommand::with_name("edit")
|
|
|
|
.about("Edit a Note")
|
|
|
|
.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("Edit Note with this name")
|
|
|
|
.value_name("NAME"))
|
2016-03-19 15:47:56 +00:00
|
|
|
|
|
|
|
.arg(tag_argument())
|
|
|
|
.group(ArgGroup::with_name("editargs")
|
|
|
|
.args(&[tag_argument_name(), "name"])
|
|
|
|
.required(true))
|
|
|
|
)
|
|
|
|
|
|
|
|
.subcommand(SubCommand::with_name("list")
|
|
|
|
.about("List Notes")
|
|
|
|
.version("0.1"))
|
|
|
|
|
|
|
|
}
|