Created
September 13, 2015 04:33
-
-
Save mysteriouspants/36baa2ee30d6ac47691a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use clap::{Arg, ArgMatches, App, SubCommand}; | |
pub fn parse_args<'a>() -> ArgMatches<'a, 'a> { | |
let matches = App::new("lod") | |
.version(&crate_version!()[..]) | |
.author("Christopher R. Miller <[email protected]") | |
.about("LOD archive utility.") | |
.subcommand_required(true) | |
.versionless_subcommands(true) | |
.unified_help_message(true) | |
.subcommand_required_else_help(true) | |
.arg(Arg::with_name("verbose") | |
.short("v") | |
.multiple(true) | |
.help("Run in verbose mode")) | |
.subcommand(SubCommand::with_name("list") | |
.about("lists the files in a LOD archive") | |
.arg(Arg::with_name("archive_file") | |
.help("The archive to read.") | |
.index(1) | |
.required(true))) | |
.get_matches(); | |
return matches; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate clap; | |
#[macro_use] mod args; | |
use args::*; | |
fn main() { | |
let args = parse_args(); | |
// presumably do more things here :) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment