Add cli module for building clap components

This commit is contained in:
Matthias Beyer 2016-05-28 20:51:44 +02:00
parent d7700a38f1
commit b3554f4fd1
2 changed files with 24 additions and 0 deletions

23
libimagtimeui/src/cli.rs Normal file
View file

@ -0,0 +1,23 @@
use clap::{Arg, ArgMatches, App, SubCommand};
pub fn build_datetime_cli_component<'a, 'b>() -> Arg<'a, 'b> {
Arg::with_name(datetime_arg_name())
.short(datetime_arg_short())
.long(datetime_arg_long())
.takes_value(true)
.multiple(false)
.help("Specify a DateTime")
}
pub fn datetime_arg_name() -> &'static str {
"datetime"
}
pub fn datetime_arg_long() -> &'static str {
"datetime"
}
pub fn datetime_arg_short() -> &'static str {
"T"
}

View file

@ -6,6 +6,7 @@ extern crate regex;
#[macro_use] extern crate libimagerror; #[macro_use] extern crate libimagerror;
pub mod cli;
pub mod date; pub mod date;
pub mod datetime; pub mod datetime;
pub mod parse; pub mod parse;