Add cli module for building clap components
This commit is contained in:
parent
d7700a38f1
commit
b3554f4fd1
2 changed files with 24 additions and 0 deletions
23
libimagtimeui/src/cli.rs
Normal file
23
libimagtimeui/src/cli.rs
Normal 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"
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ extern crate regex;
|
|||
|
||||
#[macro_use] extern crate libimagerror;
|
||||
|
||||
pub mod cli;
|
||||
pub mod date;
|
||||
pub mod datetime;
|
||||
pub mod parse;
|
||||
|
|
Loading…
Reference in a new issue