Add base arg parsing
This commit is contained in:
parent
60835165fa
commit
529ed2b429
2 changed files with 25 additions and 1 deletions
19
src/args.rs
Normal file
19
src/args.rs
Normal file
|
@ -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();
|
||||||
|
}
|
|
@ -1,3 +1,8 @@
|
||||||
|
#[macro_use]
|
||||||
|
extern crate clap;
|
||||||
|
|
||||||
|
mod args;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
let matches = args::get_matches();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue