From b3554f4fd13056e5c1ffa9aa8a06fdf869ca0661 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 28 May 2016 20:51:44 +0200 Subject: [PATCH] Add cli module for building clap components --- libimagtimeui/src/cli.rs | 23 +++++++++++++++++++++++ libimagtimeui/src/lib.rs | 1 + 2 files changed, 24 insertions(+) create mode 100644 libimagtimeui/src/cli.rs diff --git a/libimagtimeui/src/cli.rs b/libimagtimeui/src/cli.rs new file mode 100644 index 00000000..86a69f5b --- /dev/null +++ b/libimagtimeui/src/cli.rs @@ -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" +} + diff --git a/libimagtimeui/src/lib.rs b/libimagtimeui/src/lib.rs index fb409971..4486eef9 100644 --- a/libimagtimeui/src/lib.rs +++ b/libimagtimeui/src/lib.rs @@ -6,6 +6,7 @@ extern crate regex; #[macro_use] extern crate libimagerror; +pub mod cli; pub mod date; pub mod datetime; pub mod parse;