diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-05-18 21:42:49 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-07-14 21:08:46 +0200 |
commit | 05f9243164ad7cb802cc62deb9a8ca3b360ff8d1 (patch) | |
tree | 790ffca8848610613589c902f74513fa580e829d /imag-bookmark | |
parent | 5f04981c91f700c4c3a3d2c2f13bc88a01af6991 (diff) |
Add commandline specification
Diffstat (limited to 'imag-bookmark')
-rw-r--r-- | imag-bookmark/src/ui.rs | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/imag-bookmark/src/ui.rs b/imag-bookmark/src/ui.rs new file mode 100644 index 00000000..701cdbba --- /dev/null +++ b/imag-bookmark/src/ui.rs @@ -0,0 +1,100 @@ +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)")) + ) +} |