Added documentation

This commit is contained in:
Kevin K 2015-02-28 09:40:53 -05:00
parent 044849f050
commit da9607512b
2 changed files with 26 additions and 5 deletions

View file

@ -1,10 +1,35 @@
/// `FlagArg` represents a flag argument for command line applications. Flag arguments
/// take no additional values, and are always preceded by either a `-` (single character)
/// or `--` (single word, no spaces).
/// Example:
/// ```sh
/// $ myprog -a --some
/// ```
pub struct FlagArg {
/// The unique name of the argument, required
pub name: &'static str,
/// The short version (i.e. single character)
/// of the argument, no preceding `-`
pub short: Option<char>,
/// The long version of the flag (i.e. word)
/// without the preceding `--`
pub long: Option<&'static str>,
/// The string of text that will displayed to
/// the user when the application's `help`
/// text is displayed
pub help: Option<&'static str>,
/// Determines if multiple instances of the same
/// flag are allowed
/// I.e. `-v -v -v` or `-vvv`
pub multiple: bool,
/// How many occurences of this flag have been
/// found when parsing
pub occurrences: u8,
/// A list of names for other arguments that
/// *may not* be used with this flag
pub blacklist: Option<Vec<&'static str>>,
/// A list of names of other arguments that
/// are *required* to be used when this
/// flag is used
pub requires: Option<Vec<&'static str>>
}

View file

@ -4,7 +4,7 @@
#![feature(collections, core, libc, env)]
//! A simply library for parsing command line arguments when writing
//! command line applications.
//! command line and console applications.
pub use argmatches::ArgMatches;
pub use arg::Arg;
@ -14,7 +14,3 @@ mod app;
mod argmatches;
mod arg;
mod args;
#[test]
fn it_works() {
}