imag/imag-bookmark/src/ui.rs

101 lines
4.1 KiB
Rust
Raw Normal View History

2016-05-18 19:42:49 +00:00
use clap::{Arg, App, SubCommand};
use libimagentrytag::ui::tag_add_arg;
pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
app
.subcommand(SubCommand::with_name("add")
.about("Add bookmarks")
.version("0.1")
.arg(Arg::with_name("collection")
.long("collection")
.short("c")
.takes_value(true)
.required(true)
.multiple(false)
.value_name("COLLECTION")
.help("Add to this collection"))
.arg(Arg::with_name("urls")
.long("urls")
.short("u")
.takes_value(true)
.required(true)
.multiple(true)
.value_name("URL")
.help("Add this URL, multiple possible"))
.arg(tag_add_arg())
)
.subcommand(SubCommand::with_name("remove")
.about("Remove bookmarks")
.version("0.1")
.arg(Arg::with_name("collection")
.long("collection")
.short("c")
.takes_value(true)
.required(true)
.multiple(false)
.value_name("COLLECTION")
.help("Remove from this collection"))
.arg(Arg::with_name("urls")
.long("urls")
.short("u")
.takes_value(true)
.required(true)
.multiple(true)
.value_name("URL")
.help("Remove these urls, regex supported"))
)
// .subcommand(SubCommand::with_name("open")
// .about("Open bookmarks (via xdg-open)")
// .version("0.1")
// .arg(Arg::with_name("collection")
// .long("collection")
// .short("c")
// .takes_value(true)
// .required(true)
// .multiple(false)
// .value_name("COLLECTION")
// .help("Select from this collection"))
// )
.subcommand(SubCommand::with_name("list")
.about("List bookmarks")
.version("0.1")
.arg(Arg::with_name("collection")
.long("collection")
.short("c")
.takes_value(true)
.required(true)
.multiple(false)
.value_name("COLLECTION")
.help("Select from this collection"))
.arg(Arg::with_name("tags")
.long("tags")
.short("t")
.takes_value(true)
.required(false)
.multiple(true)
.value_name("TAGS")
.help("Filter links to contain these tags. When multiple tags are specified, all of them must be set for the link to match."))
)
.subcommand(SubCommand::with_name("collection")
.about("Collection commands")
.version("0.1")
.arg(Arg::with_name("add")
.long("add")
.short("a")
.takes_value(true)
.value_name("NAME")
.help("Add a collection with this name"))
.arg(Arg::with_name("remove")
.long("remove")
.short("r")
.takes_value(true)
.value_name("NAME")
.help("Remove a collection with this name (and all links)"))
)
}