diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-06-26 11:30:04 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-07-05 13:49:29 +0200 |
commit | 56759ecba85cf3f75d9ef901b07824224019686e (patch) | |
tree | f82babd554d812d6282f12286563cd64cab0d9d1 | |
parent | d5cb5be4abb69242e410b7c6a403d2e08055f69e (diff) |
Add ui module
-rw-r--r-- | imag-ref/src/main.rs | 3 | ||||
-rw-r--r-- | imag-ref/src/ui.rs | 71 |
2 files changed, 74 insertions, 0 deletions
diff --git a/imag-ref/src/main.rs b/imag-ref/src/main.rs index b4e11dcd..fd546fb3 100644 --- a/imag-ref/src/main.rs +++ b/imag-ref/src/main.rs @@ -9,6 +9,9 @@ extern crate libimagref; extern crate libimagerror; extern crate libimagentrylist; +mod ui; +use ui::build_ui; + fn main() { println!("Hello, world!"); } diff --git a/imag-ref/src/ui.rs b/imag-ref/src/ui.rs new file mode 100644 index 00000000..e884c90f --- /dev/null +++ b/imag-ref/src/ui.rs @@ -0,0 +1,71 @@ +use clap::{Arg, App, SubCommand}; + +pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { + app + .subcommand(SubCommand::with_name("add") + .about("Add a reference to a file outside of the store") + .version("0.1") + .arg(Arg::with_name("path") + .long("path") + .short("p") + .takes_value(true) + .required(true) + .help("The path of the file") + .value_name("PATH")) + .arg(Arg::with_name("track-content") + .long("content-hash") + .short("C") + .takes_value(false) + .required(false) + .help("Hash the content for the reference")) + .arg(Arg::with_name("track-permissions") + .long("permission-tracking") + .short("P") + .takes_value(false) + .required(false) + .help("Rememeber the permissions of the referenced file")) + ) + + .subcommand(SubCommand::with_name("remove") + .about("Remove a reference") + .version("0.1") + .arg(Arg::with_name("hash") + .long("hash") + .short("h") + .takes_value(true) + .required(true) + .help("Remove the reference with this hash") + .value_name("HASH")) + + .arg(Arg::with_name("yes") + .long("yes") + .short("y") + .help("Don't ask whether this really should be done")) + ) + + .subcommand(SubCommand::with_name("list") + .about("List references in the store") + .version("0.1") + + .arg(Arg::with_name("check-dead") + .long("check-dead") + .short("d") + .help("Check each reference whether it is dead")) + + .arg(Arg::with_name("check-changed") + .long("check-changed") + .short("c") + .help("Check whether a reference had changed (content or permissions)")) + + .arg(Arg::with_name("check-changed-content") + .long("check-changed-content") + .short("C") + .help("Check whether the content of the referenced file changed")) + + .arg(Arg::with_name("check-changed-permissions") + .long("check-changed-perms") + .short("P") + .help("Check whether the permissions of the referenced file changed")) + + ) +} |