Merge pull request #452 from matthiasbeyer/libimagtimeui/clap-ui

Libimagtimeui/clap ui
This commit is contained in:
Matthias Beyer 2016-05-29 10:36:04 +02:00
commit b98ccbbc01
3 changed files with 26 additions and 0 deletions

View File

@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Matthias Beyer <mail@beyermatthias.de>"] authors = ["Matthias Beyer <mail@beyermatthias.de>"]
[dependencies] [dependencies]
clap = "2.1.1"
lazy_static = "0.1" lazy_static = "0.1"
log = "0.3" log = "0.3"
chrono = "0.2" chrono = "0.2"

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

@ -1,10 +1,12 @@
extern crate chrono; extern crate chrono;
extern crate clap;
extern crate regex; extern crate regex;
#[macro_use] extern crate lazy_static; #[macro_use] extern crate lazy_static;
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[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;