Add ui module

This commit is contained in:
Matthias Beyer 2016-06-26 11:30:04 +02:00
parent d5cb5be4ab
commit 56759ecba8
2 changed files with 74 additions and 0 deletions

View file

@ -9,6 +9,9 @@ extern crate libimagref;
extern crate libimagerror;
extern crate libimagentrylist;
mod ui;
use ui::build_ui;
fn main() {
println!("Hello, world!");
}

71
imag-ref/src/ui.rs Normal file
View file

@ -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"))
)
}