diff --git a/src/args.rs b/src/args.rs new file mode 100644 index 0000000..2c41012 --- /dev/null +++ b/src/args.rs @@ -0,0 +1,19 @@ +use clap::{App, AppSettings, ArgMatches}; + + +fn build() -> App<'static, 'static> { + return App::new(crate_name!()) + .bin_name("mdp") + .about(crate_description!()) + .version(crate_version!()) + .setting(AppSettings::SubcommandRequiredElseHelp) + .global_setting(AppSettings::VersionlessSubcommands) + .global_setting(AppSettings::ColoredHelp) + .global_setting(AppSettings::GlobalVersion) + .global_setting(AppSettings::StrictUtf8) +} + + +pub fn get_matches() -> ArgMatches<'static> { + return build().get_matches(); +} diff --git a/src/main.rs b/src/main.rs index e7a11a9..c923d7c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,8 @@ +#[macro_use] +extern crate clap; + +mod args; + fn main() { - println!("Hello, world!"); + let matches = args::get_matches(); }