Restructured project to better reflect internal workings

This commit is contained in:
Kevin K 2015-03-18 15:00:15 -04:00
parent 7a6c606e9e
commit f270bc171f
6 changed files with 22 additions and 28 deletions

View file

@ -7,12 +7,7 @@ use std::env;
use std::path::Path;
use std::vec::IntoIter;
use argmatches::ArgMatches;
use Arg;
use args::OptArg;
use args::FlagArg;
use args::PosArg;
use subcommand::SubCommand;
use args::{ ArgMatches, Arg, OptArg, FlagArg, PosArg, SubCommand };
/// Used to create a representation of the program and all possible command line arguments
/// for parsing at runtime.
@ -38,19 +33,18 @@ use subcommand::SubCommand;
/// // Your pogram logic starts here...
/// ```
pub struct App {
/// The name displayed to the user when showing version and help/usage information
pub name: &'static str,
/// A string of author(s) if desired. Displayed when showing help/usage information
pub author: Option<&'static str>,
/// The version displayed to the user
pub version: Option<&'static str>,
/// A brief explaination of the program that gets displayed to the user when shown help/usage information
pub about: Option<&'static str>,
// The name displayed to the user when showing version and help/usage information
name: &'static str,
// A string of author(s) if desired. Displayed when showing help/usage information
author: Option<&'static str>,
// The version displayed to the user
version: Option<&'static str>,
// A brief explaination of the program that gets displayed to the user when shown help/usage information
about: Option<&'static str>,
flags: HashMap<&'static str, FlagArg>,
opts: HashMap<&'static str, OptArg>,
positionals_idx: BTreeMap<u8, PosArg>,
subcommands: HashMap<&'static str, Box<App>>,
// positionals_name: HashMap<&'static str, PosArg>,
needs_long_help: bool,
needs_long_version: bool,
needs_short_help: bool,

View file

@ -1,7 +1,6 @@
use std::collections::HashMap;
use args::{ FlagArg, OptArg, PosArg };
use subcommand::SubCommand;
use args::{ FlagArg, OptArg, PosArg, SubCommand };
/// Used to get information about the arguments that
/// where supplied to the program at runtime.

View file

@ -1,7 +1,13 @@
pub use self::optarg::OptArg;
pub use self::arg::Arg;
pub use self::argmatches::ArgMatches;
pub use self::flagarg::FlagArg;
pub use self::optarg::OptArg;
pub use self::posarg::PosArg;
pub use self::subcommand::SubCommand;
mod optarg;
mod arg;
mod argmatches;
mod flagarg;
mod posarg;
mod optarg;
mod posarg;
mod subcommand;

View file

@ -1,5 +1,5 @@
use app::App;
use argmatches::ArgMatches;
use App;
use ArgMatches;
/// The abstract representation of a command line subcommand used by the consumer of the library.
///

View file

@ -97,16 +97,11 @@
//! test Has test sub-functionality
//! ```
pub use argmatches::ArgMatches;
pub use arg::Arg;
pub use args::{Arg, SubCommand, ArgMatches};
pub use app::App;
pub use subcommand::SubCommand;
mod app;
mod argmatches;
mod arg;
mod args;
mod subcommand;
#[cfg(test)]
mod tests {