From d9244b687962f1e9d84fef9cf0fc9b46427ee886 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Wed, 18 Mar 2015 15:14:30 -0400 Subject: [PATCH] Rebuilt docs and inc'ed version from recent commits --- Cargo.toml | 2 +- docs/clap/arg/struct.Arg.html | 10 -- docs/clap/argmatches/struct.ArgMatches.html | 10 -- docs/clap/{ => args}/arg/index.html | 0 docs/clap/{ => args}/arg/sidebar-items.js | 0 docs/clap/args/arg/struct.Arg.html | 10 ++ docs/clap/{ => args}/argmatches/index.html | 0 .../{ => args}/argmatches/sidebar-items.js | 0 .../args/argmatches/struct.ArgMatches.html | 10 ++ docs/clap/{subcommand => args}/index.html | 0 docs/clap/args/sidebar-items.js | 1 + docs/clap/args/subcommand/index.html | 0 .../{ => args}/subcommand/sidebar-items.js | 0 .../args/subcommand/struct.SubCommand.html | 10 ++ docs/clap/index.html | 30 ++-- docs/clap/struct.App.html | 13 +- docs/clap/struct.Arg.html | 2 +- docs/clap/struct.ArgMatches.html | 2 +- docs/clap/struct.SubCommand.html | 2 +- docs/clap/subcommand/struct.SubCommand.html | 10 -- docs/main.js | 37 +++- docs/search-index.js | 2 +- docs/src/clap/app.rs/app.rs.html | 168 ++++++++++-------- docs/src/clap/{ => args}/arg.rs/arg.rs.html | 16 +- .../argmatches.rs/argmatches.rs.html | 16 +- docs/src/clap/args/mod.rs/mod.rs.html | 119 +++++++++++++ .../subcommand.rs/subcommand.rs.html | 16 +- docs/src/clap/lib.rs/lib.rs.html | 42 ++--- 28 files changed, 337 insertions(+), 191 deletions(-) delete mode 100644 docs/clap/arg/struct.Arg.html delete mode 100644 docs/clap/argmatches/struct.ArgMatches.html rename docs/clap/{ => args}/arg/index.html (100%) rename docs/clap/{ => args}/arg/sidebar-items.js (100%) create mode 100644 docs/clap/args/arg/struct.Arg.html rename docs/clap/{ => args}/argmatches/index.html (100%) rename docs/clap/{ => args}/argmatches/sidebar-items.js (100%) create mode 100644 docs/clap/args/argmatches/struct.ArgMatches.html rename docs/clap/{subcommand => args}/index.html (100%) create mode 100644 docs/clap/args/sidebar-items.js create mode 100644 docs/clap/args/subcommand/index.html rename docs/clap/{ => args}/subcommand/sidebar-items.js (100%) create mode 100644 docs/clap/args/subcommand/struct.SubCommand.html delete mode 100644 docs/clap/subcommand/struct.SubCommand.html rename docs/src/clap/{ => args}/arg.rs/arg.rs.html (98%) rename docs/src/clap/{ => args}/argmatches.rs/argmatches.rs.html (98%) create mode 100644 docs/src/clap/args/mod.rs/mod.rs.html rename docs/src/clap/{ => args}/subcommand.rs/subcommand.rs.html (93%) diff --git a/Cargo.toml b/Cargo.toml index a7ce1667..b9b9442f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "clap" -version = "0.4.6" +version = "0.4.7" authors = ["Kevin K. "] exclude = ["docs/*"] description = "A Command Line Argument Parser written in Rust" diff --git a/docs/clap/arg/struct.Arg.html b/docs/clap/arg/struct.Arg.html deleted file mode 100644 index 31e9776e..00000000 --- a/docs/clap/arg/struct.Arg.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../clap/struct.Arg.html...

- - - \ No newline at end of file diff --git a/docs/clap/argmatches/struct.ArgMatches.html b/docs/clap/argmatches/struct.ArgMatches.html deleted file mode 100644 index 23f44eff..00000000 --- a/docs/clap/argmatches/struct.ArgMatches.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Redirecting to ../../clap/struct.ArgMatches.html...

- - - \ No newline at end of file diff --git a/docs/clap/arg/index.html b/docs/clap/args/arg/index.html similarity index 100% rename from docs/clap/arg/index.html rename to docs/clap/args/arg/index.html diff --git a/docs/clap/arg/sidebar-items.js b/docs/clap/args/arg/sidebar-items.js similarity index 100% rename from docs/clap/arg/sidebar-items.js rename to docs/clap/args/arg/sidebar-items.js diff --git a/docs/clap/args/arg/struct.Arg.html b/docs/clap/args/arg/struct.Arg.html new file mode 100644 index 00000000..66cac627 --- /dev/null +++ b/docs/clap/args/arg/struct.Arg.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../../clap/struct.Arg.html...

+ + + \ No newline at end of file diff --git a/docs/clap/argmatches/index.html b/docs/clap/args/argmatches/index.html similarity index 100% rename from docs/clap/argmatches/index.html rename to docs/clap/args/argmatches/index.html diff --git a/docs/clap/argmatches/sidebar-items.js b/docs/clap/args/argmatches/sidebar-items.js similarity index 100% rename from docs/clap/argmatches/sidebar-items.js rename to docs/clap/args/argmatches/sidebar-items.js diff --git a/docs/clap/args/argmatches/struct.ArgMatches.html b/docs/clap/args/argmatches/struct.ArgMatches.html new file mode 100644 index 00000000..7cb34723 --- /dev/null +++ b/docs/clap/args/argmatches/struct.ArgMatches.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../../clap/struct.ArgMatches.html...

+ + + \ No newline at end of file diff --git a/docs/clap/subcommand/index.html b/docs/clap/args/index.html similarity index 100% rename from docs/clap/subcommand/index.html rename to docs/clap/args/index.html diff --git a/docs/clap/args/sidebar-items.js b/docs/clap/args/sidebar-items.js new file mode 100644 index 00000000..48333d31 --- /dev/null +++ b/docs/clap/args/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({}); \ No newline at end of file diff --git a/docs/clap/args/subcommand/index.html b/docs/clap/args/subcommand/index.html new file mode 100644 index 00000000..e69de29b diff --git a/docs/clap/subcommand/sidebar-items.js b/docs/clap/args/subcommand/sidebar-items.js similarity index 100% rename from docs/clap/subcommand/sidebar-items.js rename to docs/clap/args/subcommand/sidebar-items.js diff --git a/docs/clap/args/subcommand/struct.SubCommand.html b/docs/clap/args/subcommand/struct.SubCommand.html new file mode 100644 index 00000000..88a4e642 --- /dev/null +++ b/docs/clap/args/subcommand/struct.SubCommand.html @@ -0,0 +1,10 @@ + + + + + + +

Redirecting to ../../../clap/struct.SubCommand.html...

+ + + \ No newline at end of file diff --git a/docs/clap/index.html b/docs/clap/index.html index be691919..1bd90a99 100644 --- a/docs/clap/index.html +++ b/docs/clap/index.html @@ -43,7 +43,7 @@

Crate clap[stability] [-] [+] - [src]

+ [src]

A simply library for parsing command line arguments when writing command line and console applications.

@@ -66,22 +66,22 @@ determine the functioning of your program.

.author("Kevin K. <kbknapp@gmail.com>") .about("Does awesome things") .arg(Arg::new("config") - .short("c") - .long("config") - .help("Sets a custom config file") - .takes_value(true)) + .short("c") + .long("config") + .help("Sets a custom config file") + .takes_value(true)) .arg(Arg::new("output") - .help("Sets an optional output file") - .index(1)) + .help("Sets an optional output file") + .index(1)) .arg(Arg::new("debug") - .short("d") - .multiple(true) - .help("Turn debugging information on")) + .short("d") + .multiple(true) + .help("Turn debugging information on")) .subcommand(SubCommand::new("test") - .about("Has test sub functionality") - .arg(Arg::new("verbose") - .short("v") - .help("Display verbose information"))) + .about("Has test sub functionality") + .arg(Arg::new("verbose") + .short("v") + .help("Display verbose information"))) .get_matches(); if let Some(o) = matches.value_of("output") { @@ -98,7 +98,7 @@ determine the functioning of your program.

2 => println!("Debug mode is on"), 3 | _ => println!("Don't be crazy"), } - + if let Some(ref matches) = matches.subcommand_matches("test") { if matches.is_present("verbose") { println!("Printing verbose test info..."); diff --git a/docs/clap/struct.App.html b/docs/clap/struct.App.html index 94568914..ef2513aa 100644 --- a/docs/clap/struct.App.html +++ b/docs/clap/struct.App.html @@ -43,12 +43,8 @@

Struct clap::App [-] [+] - [src]

+ [src]
pub struct App {
-    pub name: &'static str,
-    pub author: Option<&'static str>,
-    pub version: Option<&'static str>,
-    pub about: Option<&'static str>,
     // some fields omitted
 }

Used to create a representation of the program and all possible command line arguments for parsing at runtime.

@@ -70,12 +66,7 @@ help and versioning information.

// Your pogram logic starts here... -

Fields

-
name

The name displayed to the user when showing version and help/usage information

-
author

A string of author(s) if desired. Displayed when showing help/usage information

-
version

The version displayed to the user

-
about

A brief explaination of the program that gets displayed to the user when shown help/usage information

-

Methods

impl App

fn new(n: &'static str) -> App

+

Methods

impl App

fn new(n: &'static str) -> App

Creates a new instance of an application requiring a name (such as the binary). Will be displayed to the user when they print version or help and usage information.

diff --git a/docs/clap/struct.Arg.html b/docs/clap/struct.Arg.html index 5eabb9cf..726f69d1 100644 --- a/docs/clap/struct.Arg.html +++ b/docs/clap/struct.Arg.html @@ -43,7 +43,7 @@

Struct clap::Arg [-] [+] - [src]

+ [src]
pub struct Arg {
     pub name: &'static str,
     pub short: Option<char>,
diff --git a/docs/clap/struct.ArgMatches.html b/docs/clap/struct.ArgMatches.html
index 4c6dcd12..2740b972 100644
--- a/docs/clap/struct.ArgMatches.html
+++ b/docs/clap/struct.ArgMatches.html
@@ -43,7 +43,7 @@
     

Struct clap::ArgMatches [-] [+] - [src]

+ [src]
pub struct ArgMatches {
     pub matches_of: &'static str,
     pub flags: HashMap<&'static str, FlagArg>,
diff --git a/docs/clap/struct.SubCommand.html b/docs/clap/struct.SubCommand.html
index 7f917f56..ca8680f4 100644
--- a/docs/clap/struct.SubCommand.html
+++ b/docs/clap/struct.SubCommand.html
@@ -43,7 +43,7 @@
     

Struct clap::SubCommand [-] [+] - [src]

+ [src]
pub struct SubCommand {
     pub name: &'static str,
     pub matches: ArgMatches,
diff --git a/docs/clap/subcommand/struct.SubCommand.html b/docs/clap/subcommand/struct.SubCommand.html
deleted file mode 100644
index 3f25d990..00000000
--- a/docs/clap/subcommand/struct.SubCommand.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-    
-
-
-    

Redirecting to ../../clap/struct.SubCommand.html...

- - - \ No newline at end of file diff --git a/docs/main.js b/docs/main.js index 9fa8cf79..ca6d9441 100644 --- a/docs/main.js +++ b/docs/main.js @@ -209,6 +209,33 @@ break; } } + // searching by type + } else if (val.search("->") > -1) { + var trimmer = function (s) { return s.trim(); }; + var parts = val.split("->").map(trimmer); + var input = parts[0]; + // sort inputs so that order does not matter + var inputs = input.split(",").map(trimmer).sort(); + var output = parts[1]; + + for (var i = 0; i < nSearchWords; ++i) { + var type = searchIndex[i].type; + if (!type) { + continue; + } + + // sort index inputs so that order does not matter + var typeInputs = type.inputs.map(function (input) { + return input.name; + }).sort(); + + // allow searching for void (no output) functions as well + var typeOutput = type.output ? type.output.name : ""; + if (inputs.toString() === typeInputs.toString() && + output == typeOutput) { + results.push({id: i, index: -1, dontValidate: true}); + } + } } else { // gather matching search results up to a certain maximum val = val.replace(/\_/g, ""); @@ -329,6 +356,11 @@ path = result.item.path.toLowerCase(), parent = result.item.parent; + // this validation does not make sense when searching by types + if (result.dontValidate) { + continue; + } + var valid = validateResult(name, path, split, parent); if (!valid) { result.id = -1; @@ -573,7 +605,8 @@ // (String) name, // (String) full path or empty string for previous path, // (String) description, - // (optional Number) the parent path index to `paths`] + // (Number | null) the parent path index to `paths`] + // (Object | null) the type of the function (if any) var items = rawSearchIndex[crate].items; // an array of [(Number) item type, // (String) name] @@ -598,7 +631,7 @@ var rawRow = items[i]; var row = {crate: crate, ty: rawRow[0], name: rawRow[1], path: rawRow[2] || lastPath, desc: rawRow[3], - parent: paths[rawRow[4]]}; + parent: paths[rawRow[4]], type: rawRow[5]}; searchIndex.push(row); if (typeof row.name === "string") { var word = row.name.toLowerCase(); diff --git a/docs/search-index.js b/docs/search-index.js index 7ebd9f83..b649daf7 100644 --- a/docs/search-index.js +++ b/docs/search-index.js @@ -1,3 +1,3 @@ var searchIndex = {}; -searchIndex['clap'] = {"items":[[0,"","clap","A simply library for parsing command line arguments when writing\ncommand line and console applications."],[3,"ArgMatches","","Used to get information about the arguments that\nwhere supplied to the program at runtime."],[12,"matches_of","","",0],[12,"flags","","",0],[12,"opts","","",0],[12,"positionals","","",0],[12,"subcommand","","",0],[3,"Arg","","The abstract representation of a command line argument used by the consumer of the library.\n "],[12,"name","","The unique name of the argument, required",1],[12,"short","","The short version (i.e. single character) of the argument, no preceding `-`\n**NOTE:** `short` is mutually exclusive with `index`",1],[12,"long","","The long version of the flag (i.e. word) without the preceding `--`\n**NOTE:** `long` is mutually exclusive with `index`",1],[12,"help","","The string of text that will displayed to the user when the application's\n`help` text is displayed",1],[12,"required","","If this is a required by default when using the command line program\ni.e. a configuration file that's required for the program to function\n**NOTE:** required by default means, it is required *until* mutually\nexclusive arguments are evaluated.",1],[12,"takes_value","","Determines if this argument is an option, vice a flag or positional and\nis mutually exclusive with `index` and `multiple`",1],[12,"index","","The index of the argument. `index` is mutually exclusive with `takes_value`\nand `multiple`",1],[12,"multiple","","Determines if multiple instances of the same flag are allowed. `multiple`\nis mutually exclusive with `index` and `takes_value`.\nI.e. `-v -v -v` or `-vvv`",1],[12,"blacklist","","A list of names for other arguments that *may not* be used with this flag",1],[12,"requires","","A list of names of other arguments that are *required* to be used when\nthis flag is used",1],[3,"App","","Used to create a representation of the program and all possible command line arguments\nfor parsing at runtime."],[12,"name","","The name displayed to the user when showing version and help/usage information",2],[12,"author","","A string of author(s) if desired. Displayed when showing help/usage information",2],[12,"version","","The version displayed to the user",2],[12,"about","","A brief explaination of the program that gets displayed to the user when shown help/usage information",2],[3,"SubCommand","","The abstract representation of a command line subcommand used by the consumer of the library.\n "],[12,"name","","",3],[12,"matches","","",3],[11,"new","","Creates a new instance of an application requiring a name (such as the binary). Will be displayed\nto the user when they print version or help and usage information.",2],[11,"author","","Sets a string of author(s)",2],[11,"about","","Sets a string briefly describing what the program does",2],[11,"version","","Sets a string of the version number",2],[11,"usage","","Sets a custom usage string to over-ride the one auto-generated by `clap`\n \n*NOTE:* You do not need to specify the \"USAGE: \" portion, as that will \nstill be applied by `clap`, you only need to specify the portion starting\nwith the binary name. \n \n*NOTE:* This will not replace the entire help message, only the portion\nshowing the usage.",2],[11,"arg","","Adds an argument to the list of valid possibilties",2],[11,"args","","Adds multiple arguments to the list of valid possibilties",2],[11,"subcommand","","Adds a subcommand to the list of valid possibilties. Subcommands\nare effectively sub apps, because they can contain their own arguments\nand subcommands. They also function just like apps, in that they get their\nown auto generated help and version switches.",2],[11,"subcommands","","Adds multiple subcommands to the list of valid possibilties",2],[11,"get_matches","","",2],[11,"new","","Creates a new instance of `ArgMatches`. This ins't called directly, but\nthrough the `.get_matches()` method of `App`",0],[11,"value_of","","Gets the value of a specific option or positional argument (i.e. an argument that takes\nan additional value at runtime). If the option wasn't present at runtime\nit returns `None`",0],[11,"is_present","","Checks if a flag was argument was supplied at runtime. **DOES NOT** work for\noption or positional arguments (use `.value_of()` instead)",0],[11,"occurrences_of","","Checks the number of occurrences of a flag at runtime.",0],[11,"subcommand_matches","","If a subcommand was found, returns the ArgMatches struct associated with it's matches",0],[11,"subcommand_name","","If a subcommand was found, returns the name associated with it",0],[11,"new","","Creates a new instace of `Arg` using a unique string name.\nThe name will be used by the library consumer to get information about\nwhether or not the argument was used at runtime. ",1],[11,"short","","Sets the short version of the argument without the preceding `-`.",1],[11,"long","","Sets the long version of the argument without the preceding `--`.",1],[11,"help","","Sets the help text of the argument that will be displayed to the user\nwhen they print the usage/help information. ",1],[11,"required","","Sets whether or not the argument is required by default. Required by\ndefault means it is required, when no other mutually exlusive rules have\nbeen evaluated. Mutually exclusive rules take precedence over being required\nby default.",1],[11,"mutually_excludes","","Sets a mutually exclusive argument by name. I.e. when using this argument,\nthe following argument can't be present.",1],[11,"mutually_excludes_all","","Sets a mutually exclusive arguments by names. I.e. when using this argument,\nthe following argument can't be present.",1],[11,"requires","","Sets an argument by name that is required when this one is presnet I.e. when\nusing this argument, the following argument *must* be present.",1],[11,"requires_all","","Sets arguments by names that are required when this one is presnet I.e. when\nusing this argument, the following arguments *must* be present.",1],[11,"takes_value","","Specifies that the argument takes an additional value at run time.\n \n**NOTE:** When setting this to `true` the `name` of the argument\nwill be used when printing the help/usage information to the user. ",1],[11,"index","","Specifies the index of a positional argument starting at 1.\n \n**NOTE:** When setting this, any `short` or `long` values you set\nare ignored as positional arguments cannot have a `short` or `long`.\nAlso, the name will be used when printing the help/usage information \nto the user. ",1],[11,"multiple","","Specifies if the flag may appear more than once such as for multiple debugging\nlevels (as an example). `-ddd` for three levels of debugging, or `-d -d -d`. \nWhen this is set to `true` you recieve the number of occurances the user supplied\nof a particular flag at runtime.\n \n**NOTE:** When setting this, any `takes_value` or `index` values you set\nare ignored as flags cannot have a values or an `index`.",1],[11,"new","","Creates a new instance of a subcommand requiring a name. Will be displayed\nto the user when they print version or help and usage information.",3]],"paths":[[3,"ArgMatches"],[3,"Arg"],[3,"App"],[3,"SubCommand"]]}; +searchIndex['clap'] = {"items":[[0,"","clap","A simply library for parsing command line arguments when writing\ncommand line and console applications.",null,null],[3,"Arg","","The abstract representation of a command line argument used by the consumer of the library.\n ",null,null],[12,"name","","The unique name of the argument, required",0,null],[12,"short","","The short version (i.e. single character) of the argument, no preceding `-`\n**NOTE:** `short` is mutually exclusive with `index`",0,null],[12,"long","","The long version of the flag (i.e. word) without the preceding `--`\n**NOTE:** `long` is mutually exclusive with `index`",0,null],[12,"help","","The string of text that will displayed to the user when the application's\n`help` text is displayed",0,null],[12,"required","","If this is a required by default when using the command line program\ni.e. a configuration file that's required for the program to function\n**NOTE:** required by default means, it is required *until* mutually\nexclusive arguments are evaluated.",0,null],[12,"takes_value","","Determines if this argument is an option, vice a flag or positional and\nis mutually exclusive with `index` and `multiple`",0,null],[12,"index","","The index of the argument. `index` is mutually exclusive with `takes_value`\nand `multiple`",0,null],[12,"multiple","","Determines if multiple instances of the same flag are allowed. `multiple`\nis mutually exclusive with `index` and `takes_value`.\nI.e. `-v -v -v` or `-vvv`",0,null],[12,"blacklist","","A list of names for other arguments that *may not* be used with this flag",0,null],[12,"requires","","A list of names of other arguments that are *required* to be used when\nthis flag is used",0,null],[3,"SubCommand","","The abstract representation of a command line subcommand used by the consumer of the library.\n ",null,null],[12,"name","","",1,null],[12,"matches","","",1,null],[3,"ArgMatches","","Used to get information about the arguments that\nwhere supplied to the program at runtime.",null,null],[12,"matches_of","","",2,null],[12,"flags","","",2,null],[12,"opts","","",2,null],[12,"positionals","","",2,null],[12,"subcommand","","",2,null],[3,"App","","Used to create a representation of the program and all possible command line arguments\nfor parsing at runtime.",null,null],[11,"new","","Creates a new instance of an application requiring a name (such as the binary). Will be displayed\nto the user when they print version or help and usage information.",3,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"author","","Sets a string of author(s)",3,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"about","","Sets a string briefly describing what the program does",3,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"version","","Sets a string of the version number",3,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"usage","","Sets a custom usage string to over-ride the one auto-generated by `clap`\n \n*NOTE:* You do not need to specify the \"USAGE: \" portion, as that will \nstill be applied by `clap`, you only need to specify the portion starting\nwith the binary name. \n \n*NOTE:* This will not replace the entire help message, only the portion\nshowing the usage.",3,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"arg","","Adds an argument to the list of valid possibilties",3,{"inputs":[{"name":"app"},{"name":"arg"}],"output":{"name":"app"}}],[11,"args","","Adds multiple arguments to the list of valid possibilties",3,{"inputs":[{"name":"app"},{"name":"vec"}],"output":{"name":"app"}}],[11,"subcommand","","Adds a subcommand to the list of valid possibilties. Subcommands\nare effectively sub apps, because they can contain their own arguments\nand subcommands. They also function just like apps, in that they get their\nown auto generated help and version switches.",3,{"inputs":[{"name":"app"},{"name":"app"}],"output":{"name":"app"}}],[11,"subcommands","","Adds multiple subcommands to the list of valid possibilties",3,{"inputs":[{"name":"app"},{"name":"vec"}],"output":{"name":"app"}}],[11,"get_matches","","",3,{"inputs":[{"name":"app"}],"output":{"name":"argmatches"}}],[11,"new","","Creates a new instace of `Arg` using a unique string name.\nThe name will be used by the library consumer to get information about\nwhether or not the argument was used at runtime. ",0,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"short","","Sets the short version of the argument without the preceding `-`.",0,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"long","","Sets the long version of the argument without the preceding `--`.",0,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"help","","Sets the help text of the argument that will be displayed to the user\nwhen they print the usage/help information. ",0,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"required","","Sets whether or not the argument is required by default. Required by\ndefault means it is required, when no other mutually exlusive rules have\nbeen evaluated. Mutually exclusive rules take precedence over being required\nby default.",0,{"inputs":[{"name":"arg"},{"name":"bool"}],"output":{"name":"arg"}}],[11,"mutually_excludes","","Sets a mutually exclusive argument by name. I.e. when using this argument,\nthe following argument can't be present.",0,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"mutually_excludes_all","","Sets a mutually exclusive arguments by names. I.e. when using this argument,\nthe following argument can't be present.",0,{"inputs":[{"name":"arg"},{"name":"vec"}],"output":{"name":"arg"}}],[11,"requires","","Sets an argument by name that is required when this one is presnet I.e. when\nusing this argument, the following argument *must* be present.",0,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"requires_all","","Sets arguments by names that are required when this one is presnet I.e. when\nusing this argument, the following arguments *must* be present.",0,{"inputs":[{"name":"arg"},{"name":"vec"}],"output":{"name":"arg"}}],[11,"takes_value","","Specifies that the argument takes an additional value at run time.\n \n**NOTE:** When setting this to `true` the `name` of the argument\nwill be used when printing the help/usage information to the user. ",0,{"inputs":[{"name":"arg"},{"name":"bool"}],"output":{"name":"arg"}}],[11,"index","","Specifies the index of a positional argument starting at 1.\n \n**NOTE:** When setting this, any `short` or `long` values you set\nare ignored as positional arguments cannot have a `short` or `long`.\nAlso, the name will be used when printing the help/usage information \nto the user. ",0,{"inputs":[{"name":"arg"},{"name":"u8"}],"output":{"name":"arg"}}],[11,"multiple","","Specifies if the flag may appear more than once such as for multiple debugging\nlevels (as an example). `-ddd` for three levels of debugging, or `-d -d -d`. \nWhen this is set to `true` you recieve the number of occurances the user supplied\nof a particular flag at runtime.\n \n**NOTE:** When setting this, any `takes_value` or `index` values you set\nare ignored as flags cannot have a values or an `index`.",0,{"inputs":[{"name":"arg"},{"name":"bool"}],"output":{"name":"arg"}}],[11,"new","","Creates a new instance of `ArgMatches`. This ins't called directly, but\nthrough the `.get_matches()` method of `App`",2,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"argmatches"}}],[11,"value_of","","Gets the value of a specific option or positional argument (i.e. an argument that takes\nan additional value at runtime). If the option wasn't present at runtime\nit returns `None`",2,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"option"}}],[11,"is_present","","Checks if a flag was argument was supplied at runtime. **DOES NOT** work for\noption or positional arguments (use `.value_of()` instead)",2,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"bool"}}],[11,"occurrences_of","","Checks the number of occurrences of a flag at runtime.",2,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"u8"}}],[11,"subcommand_matches","","If a subcommand was found, returns the ArgMatches struct associated with it's matches",2,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"option"}}],[11,"subcommand_name","","If a subcommand was found, returns the name associated with it",2,{"inputs":[{"name":"argmatches"}],"output":{"name":"option"}}],[11,"new","","Creates a new instance of a subcommand requiring a name. Will be displayed\nto the user when they print version or help and usage information.",1,{"inputs":[{"name":"subcommand"},{"name":"str"}],"output":{"name":"app"}}]],"paths":[[3,"Arg"],[3,"SubCommand"],[3,"ArgMatches"],[3,"App"]]}; initSearch(searchIndex); diff --git a/docs/src/clap/app.rs/app.rs.html b/docs/src/clap/app.rs/app.rs.html index 80004721..2bf03d28 100644 --- a/docs/src/clap/app.rs/app.rs.html +++ b/docs/src/clap/app.rs/app.rs.html @@ -907,6 +907,14 @@ 865 866 867 +868 +869 +870 +871 +872 +873 +874 +875
 extern crate libc;
 
@@ -917,12 +925,7 @@
 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.
@@ -948,19 +951,18 @@
 /// // 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,
@@ -1257,13 +1259,13 @@
             let flags = ! self.flags.is_empty();
             let pos = ! self.positionals_idx.is_empty();
             let req_pos = self.positionals_idx.values().filter_map(|ref x| if x.required { Some(x.name) } else {None})
-                                                       .fold(String::new(), |acc, ref name| acc + &format!("<{}> ", name.to_uppercase())[..]);
+                                                       .fold(String::new(), |acc, ref name| acc + &format!("<{}> ", name)[..]);
             let req_opts = self.opts.values().filter(|ref x| x.required)
                                              .fold(String::new(), |acc, ref o| acc + &format!("{}{} ",if let Some(s) = o.short {
                                                                                                      format!("-{} ", s)
                                                                                                    } else {
                                                                                                        format!("--{}=",o.long.unwrap())
-                                                                                                   },o.name.to_uppercase()));
+                                                                                                   },o.name));
             let opts = ! self.opts.is_empty();
             let subcmds = ! self.subcommands.is_empty();
 
@@ -1319,7 +1321,7 @@
                 println!("\t{}{}{}\t{}",
                         if let Some(ref s) = v.short{format!("-{} ",s)}else{format!("   ")},
                         if let Some(ref l) = v.long {format!(",--{}=",l)}else {needs_tab = true; format!(" ")},
-                        format!("{}", v.name.to_uppercase()),
+                        format!("{}", v.name),
                         if let Some(ref h) = v.help {if needs_tab {format!("\t{}", *h)} else { format!("{}", *h) } } else {format!("   ")} );
             }
         }
@@ -1357,7 +1359,7 @@
     }
 
     fn parse_long_arg(&mut self, matches: &mut ArgMatches ,full_arg: &String) -> Option<&'static str> {
-        let mut arg = full_arg.as_slice().trim_left_matches(|c| c == '-');
+        let mut arg = full_arg.trim_left_matches(|c| c == '-');
         let mut found = false;
 
         if arg == "help" && self.needs_long_help {
@@ -1436,12 +1438,15 @@
                 }
                 if let Some(ref reqs) = v.requires {
                     if ! reqs.is_empty() {
-                        for n in reqs.iter() {
-                            if matches.opts.contains_key(n) { continue; }
-                            if matches.flags.contains_key(n) { continue; }
-                            if matches.positionals.contains_key(n) { continue; }
-                            self.required.insert(n);
-                        }
+	                	// Add all required args which aren't already found in matches to the
+	                	// final required list
+	                    for n in reqs.iter().filter(|&a|
+	                        ! matches.opts.contains_key(a) ||
+	                        ! matches.flags.contains_key(a) ||
+	                        ! matches.positionals.contains_key(a) ) {
+
+	                    	self.required.insert(n);
+	                    }
                     }
                 }
                 break;
@@ -1457,7 +1462,7 @@
     }
 
     fn parse_short_arg(&mut self, matches: &mut ArgMatches ,full_arg: &String) -> Option<&'static str> {
-        let arg = full_arg.as_slice().trim_left_matches(|c| c == '-');
+        let arg = &full_arg[..].trim_left_matches(|c| c == '-');
         if arg.len() > 1 { 
             // Multiple flags using short i.e. -bgHlS
             for c in arg.chars() {
@@ -1470,7 +1475,7 @@
             }
         } else {
             // Short flag or opt
-            let arg_c = arg.char_at(0);
+            let arg_c = arg.chars().nth(0).unwrap();
             self.check_for_help_and_version(arg_c);
 
             if ! self.parse_single_short_flag(matches, arg_c) { 
@@ -1613,66 +1618,74 @@
     fn get_matches_from(&mut self, matches: &mut ArgMatches, it: &mut IntoIter<String>) {
         self.create_help_and_version();
 
-        // let mut needs_val = false;
+        let mut pos_only = false;
         let mut subcmd_name: Option<&'static str> = None;
         let mut needs_val_of: Option<&'static str> = None; 
         let mut pos_counter = 1;
         while let Some(arg) = it.next() {
-            let arg_slice = arg.as_slice();
+            let arg_slice = &arg[..];
             let mut skip = false;
-            if let Some(nvo) = needs_val_of {
-                if let Some(ref opt) = self.opts.get(nvo) {
-                    if self.blacklist.contains(opt.name) {
-                        self.report_error(
-                            format!("The argument {} is mutually exclusive with one or more other arguments", 
-                            if let Some(long) = opt.long {
-                                format!("--{}",long)
-                            }else{
-                                format!("-{}",opt.short.unwrap())
-                            }),true, true);
-                    }
-                    matches.opts.insert(nvo, OptArg{
-                        name: opt.name,
-                        short: opt.short,
-                        long: opt.long, 
-                        help: opt.help,
-                        requires: None,
-                        blacklist: None,
-                        required: opt.required,
-                        value: Some(arg.clone()) 
-                    });
-                    if let Some(ref bl) = opt.blacklist {
-                        if ! bl.is_empty() {
-                            for name in bl.iter() {
-                                self.blacklist.insert(name);
+            if ! pos_only {
+                if let Some(nvo) = needs_val_of {
+                    if let Some(ref opt) = self.opts.get(nvo) {
+                        if self.blacklist.contains(opt.name) {
+                            self.report_error(
+                                format!("The argument {} is mutually exclusive with one or more other arguments", 
+                                if let Some(long) = opt.long {
+                                    format!("--{}",long)
+                                }else{
+                                    format!("-{}",opt.short.unwrap())
+                                }),true, true);
+                        }
+                        matches.opts.insert(nvo, OptArg{
+                            name: opt.name,
+                            short: opt.short,
+                            long: opt.long, 
+                            help: opt.help,
+                            requires: None,
+                            blacklist: None,
+                            required: opt.required,
+                            value: Some(arg.clone()) 
+                        });
+                        if let Some(ref bl) = opt.blacklist {
+                            if ! bl.is_empty() {
+                                for name in bl.iter() {
+                                    self.blacklist.insert(name);
+                                }
                             }
                         }
-                    }
-                    if self.required.contains(opt.name) {
-                        self.required.remove(opt.name);
-                    }
-                    if let Some(ref reqs) = opt.requires {
-                        if ! reqs.is_empty() {
-                            for n in reqs.iter() {
-                                if matches.opts.contains_key(n) { continue; }
-                                if matches.flags.contains_key(n) { continue; }
-                                if matches.positionals.contains_key(n) { continue; }
-                                self.required.insert(n);
-                            }
+                        if self.required.contains(opt.name) {
+                            self.required.remove(opt.name);
                         }
+                        if let Some(ref reqs) = opt.requires {
+                            if ! reqs.is_empty() {
+	                        	// Add all required args which aren't already found in matches to the
+	                        	// final required list
+	                            for n in reqs.iter().filter(|&a|
+	                                ! matches.opts.contains_key(a) ||
+	                                ! matches.flags.contains_key(a) ||
+	                                ! matches.positionals.contains_key(a) ) {
+
+	                            	self.required.insert(n);
+	                            }
+	                        }
+                        }
+                        skip = true;
                     }
-                    skip = true;
                 }
             }
             if skip {
                 needs_val_of = None;
                 continue;
             }
-            if arg_slice.starts_with("--") {
+            if arg_slice.starts_with("--") && ! pos_only {
+                if arg_slice.len() == 2 {
+                    pos_only = true;
+                    continue;
+                }
                 // Single flag, or option long version
                 needs_val_of = self.parse_long_arg(matches, &arg);
-
-            } else if arg_slice.starts_with("-") {
+            } else if arg_slice.starts_with("-") && arg_slice.len() != 1 && ! pos_only {
                 needs_val_of = self.parse_short_arg(matches, &arg);
             } else {
                 // Positional or Subcommand
@@ -1684,7 +1697,7 @@
                     break;
                 }
 
-                if self.positionals_idx.is_empty() { // || self.positionals_name.is_empty() {
+                if self.positionals_idx.is_empty() {
                     self.report_error(
                         format!("Found positional argument {}, but {} doesn't accept any", arg, self.name),
                         true, true);
@@ -1715,11 +1728,14 @@
                     }
                     if let Some(ref reqs) = p.requires {
                         if ! reqs.is_empty() {
-                            for n in reqs.iter() {
-                                if matches.opts.contains_key(n) { continue; }
-                                if matches.flags.contains_key(n) { continue; }
-                                if matches.positionals.contains_key(n) { continue; }
-                                self.required.insert(n);
+                        	// Add all required args which aren't already found in matches to the
+                        	// final required list
+                            for n in reqs.iter().filter(|&a|
+                                ! matches.opts.contains_key(a) ||
+                                ! matches.flags.contains_key(a) ||
+                                ! matches.positionals.contains_key(a) ) {
+
+                            	self.required.insert(n);
                             }
                         }
                     }
diff --git a/docs/src/clap/arg.rs/arg.rs.html b/docs/src/clap/args/arg.rs/arg.rs.html
similarity index 98%
rename from docs/src/clap/arg.rs/arg.rs.html
rename to docs/src/clap/args/arg.rs/arg.rs.html
index 48afd778..f3174137 100644
--- a/docs/src/clap/arg.rs/arg.rs.html
+++ b/docs/src/clap/args/arg.rs/arg.rs.html
@@ -4,12 +4,12 @@
     
     
     
-    
+    
     
 
     arg.rs.html -- source
 
-    
+    
 
     
     
@@ -377,7 +377,6 @@
 335
 336
 337
-338
 
 /// The abstract representation of a command line argument used by the consumer of the library.
 /// 
@@ -486,8 +485,7 @@
     /// .short("c")
     /// # ).get_matches();
     pub fn short(mut self, s: &'static str) -> Arg {
-        self.short = Some(s.trim_left_matches(|c| c == '-')
-                           .char_at(0));
+        self.short = s.trim_left_matches(|c| c == '-').chars().nth(0);
         self
     }
 
@@ -757,13 +755,13 @@
     
 
     
-    
-    
+    
+    
     
-    
+    
 
 
\ No newline at end of file
diff --git a/docs/src/clap/argmatches.rs/argmatches.rs.html b/docs/src/clap/args/argmatches.rs/argmatches.rs.html
similarity index 98%
rename from docs/src/clap/argmatches.rs/argmatches.rs.html
rename to docs/src/clap/args/argmatches.rs/argmatches.rs.html
index 98540824..217dba16 100644
--- a/docs/src/clap/argmatches.rs/argmatches.rs.html
+++ b/docs/src/clap/args/argmatches.rs/argmatches.rs.html
@@ -4,12 +4,12 @@
     
     
     
-    
+    
     
 
     argmatches.rs.html -- source
 
-    
+    
 
     
     
@@ -246,12 +246,10 @@
 204
 205
 206
-207
 
 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.
@@ -495,13 +493,13 @@
     
 
     
-    
-    
+    
+    
     
-    
+    
 
 
\ No newline at end of file
diff --git a/docs/src/clap/args/mod.rs/mod.rs.html b/docs/src/clap/args/mod.rs/mod.rs.html
new file mode 100644
index 00000000..50024411
--- /dev/null
+++ b/docs/src/clap/args/mod.rs/mod.rs.html
@@ -0,0 +1,119 @@
+
+
+
+    
+    
+    
+    
+    
+
+    mod.rs.html -- source
+
+    
+
+    
+    
+
+
+    
+
+    
+
+    
+
+    
+
+    
 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+
+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 arg;
+mod argmatches;
+mod flagarg;
+mod optarg;
+mod posarg;
+mod subcommand;
+
+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/src/clap/subcommand.rs/subcommand.rs.html b/docs/src/clap/args/subcommand.rs/subcommand.rs.html similarity index 93% rename from docs/src/clap/subcommand.rs/subcommand.rs.html rename to docs/src/clap/args/subcommand.rs/subcommand.rs.html index ff8fceb1..d45ad64e 100644 --- a/docs/src/clap/subcommand.rs/subcommand.rs.html +++ b/docs/src/clap/args/subcommand.rs/subcommand.rs.html @@ -4,12 +4,12 @@ - + subcommand.rs.html -- source - + @@ -84,8 +84,8 @@ 42 43
-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.
 /// 
@@ -167,13 +167,13 @@
     
 
     
-    
-    
+    
+    
     
-    
+    
 
 
\ No newline at end of file
diff --git a/docs/src/clap/lib.rs/lib.rs.html b/docs/src/clap/lib.rs/lib.rs.html
index 4d6de5ed..90f0ee35 100644
--- a/docs/src/clap/lib.rs/lib.rs.html
+++ b/docs/src/clap/lib.rs/lib.rs.html
@@ -190,15 +190,10 @@
 148
 149
 150
-151
-152
-153
-154
-155
 
 #![crate_type= "lib"]
 
-#![feature(collections, core, libc, exit_status)]
+#![feature(libc, exit_status)]
 
 //! A simply library for parsing command line arguments when writing 
 //! command line and console applications.
@@ -224,22 +219,22 @@
 //!                        .author("Kevin K. <kbknapp@gmail.com>")
 //!                        .about("Does awesome things")
 //!                        .arg(Arg::new("config")
-//!                                    .short("c")
-//!                                    .long("config")
-//!                                    .help("Sets a custom config file")
-//!                                    .takes_value(true))
+//!                             .short("c")
+//!                             .long("config")
+//!                             .help("Sets a custom config file")
+//!                             .takes_value(true))
 //!                        .arg(Arg::new("output")
-//!                                    .help("Sets an optional output file")
-//!                                    .index(1))
+//!                             .help("Sets an optional output file")
+//!                             .index(1))
 //!                        .arg(Arg::new("debug")
-//!                                    .short("d")
-//!                                 .multiple(true)
-//!                                    .help("Turn debugging information on"))
+//!                             .short("d")
+//!                             .multiple(true)
+//!                             .help("Turn debugging information on"))
 //!                        .subcommand(SubCommand::new("test")
-//!                                                .about("Has test sub functionality")
-//!                                                .arg(Arg::new("verbose")
-//!                                                            .short("v")
-//!                                                            .help("Display verbose information")))
+//!                                    .about("Has test sub functionality")
+//!                                    .arg(Arg::new("verbose")
+//!                                         .short("v")
+//!                                         .help("Display verbose information")))
 //!                        .get_matches();
 //!
 //!    if let Some(o) = matches.value_of("output") {
@@ -256,7 +251,7 @@
 //!        2 => println!("Debug mode is on"),
 //!        3 | _ => println!("Don't be crazy"),
 //! }
-//! 
+//!
 //! if let Some(ref matches) = matches.subcommand_matches("test") {
 //!     if matches.is_present("verbose") {
 //!            println!("Printing verbose test info...");
@@ -295,16 +290,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 {