From 550a2f3a05ba24bc3654cec77cc7224139cb50e4 Mon Sep 17 00:00:00 2001 From: Kevin K Date: Mon, 27 Apr 2015 23:20:11 -0400 Subject: [PATCH] chore(docs): rebuild docs with nightly --- docs/clap/args/group/sidebar-items.js | 2 +- docs/clap/index.html | 184 +++++++++++++++------- docs/clap/macro.arg_enum!.html | 6 +- docs/clap/macro.crate_version!.html | 6 +- docs/clap/macro.simple_enum!.html | 6 +- docs/clap/macro.value_t!.html | 6 +- docs/clap/macro.value_t_or_exit!.html | 6 +- docs/clap/sidebar-items.js | 2 +- docs/clap/struct.App.html | 36 ++--- docs/clap/struct.Arg.html | 42 ++--- docs/clap/struct.ArgGroup.html | 77 ++++----- docs/clap/struct.ArgMatches.html | 22 +-- docs/clap/struct.SubCommand.html | 10 +- docs/implementors/core/fmt/trait.Debug.js | 2 +- docs/main.css | 63 ++++---- docs/main.js | 42 +++-- docs/search-index.js | 2 +- docs/src/clap/args/group.rs.html | 60 ++++--- docs/src/clap/lib.rs.html | 100 ++++++++++-- 19 files changed, 424 insertions(+), 250 deletions(-) diff --git a/docs/clap/args/group/sidebar-items.js b/docs/clap/args/group/sidebar-items.js index da126823..b8368b9c 100644 --- a/docs/clap/args/group/sidebar-items.js +++ b/docs/clap/args/group/sidebar-items.js @@ -1 +1 @@ -initSidebarItems({"struct":[["ArgGroup","ArgGroups are a family of related arguments and provide a few useful features for you. By placing arguments in a logical group, you can make easier requirement and exclusion rules. For instance, you can make an ArgGroup required, this means that one (and *only* one) argument from that group must be present. Using more than one argument from an ArgGroup causes a failure (graceful exit)."]]}); \ No newline at end of file +initSidebarItems({"struct":[["ArgGroup","`ArgGroup`s are a family of related arguments and way for you to say, \"Any of these arguments\". By placing arguments in a logical group, you can make easier requirement and exclusion rules intead of having to list each individually, or when you want a rule to apply \"any but not all\" arguments. "]]}); \ No newline at end of file diff --git a/docs/clap/index.html b/docs/clap/index.html index 31c27392..2fed2acd 100644 --- a/docs/clap/index.html +++ b/docs/clap/index.html @@ -41,9 +41,9 @@
-

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

+

Crate clap + [-] + [src]

clap

@@ -51,15 +51,15 @@

Command Line Argument Parser for Rust

-

It is a simple to use and efficient library for parsing command line arguments and subcommands when writing console, or terminal applications.

+

It is a simple to use, efficient, and full featured library for parsing command line arguments and subcommands when writing console, or terminal applications.

About

-

clap is used to parse and validate the string of command line arguments provided by the user at runtime. You simply provide the list of valid possibilities, and clap handles the rest. This means you focus on your applications functionality, and less on the parsing and validating of arguments.

+

clap is used to parse and validate the string of command line arguments provided by the user at runtime. You provide the list of valid possibilities, and clap handles the rest. This means you focus on your applications functionality, and less on the parsing and validating of arguments.

-

clap also provides all the traditional version and help switches (or flags) 'for free.' It does this by checking list of valid possibilities you supplied and if you haven't defined those flags already (or only defined some of them), clap will auto-generate the applicable ones (as well as a "help" subcommand so long as other subcommands have been manually defined as well).

+

clap also provides the traditional version and help switches (or flags) 'for free' meaning automatically with no configuration. It does this by checking list of valid possibilities you supplied and if you haven't them already (or only defined some of them), clap will auto-generate the applicable ones. If you are using subcommands, clap will also auto-generate a help subcommand for you in addition to the traditional flags.

-

After clap finishes parsing the user provided string, it returns all the matches along with any applicable values. If the user made an error or typo, clap informs them of the mistake and exits gracefully. Because of this, you can make reasonable assumptions in your code, and worry less about error handling.

+

Once clap parses the user provided string of arguments, it returns the matches along with any applicable values. If the user made an error or typo, clap informs them of the mistake and exits gracefully. Because of this, you can make reasonable assumptions in your code about the validity of the arguments.

Features

@@ -76,7 +76,7 @@
  • Both short and long versions supported (i.e. -f and --flag respectively)
  • Supports combining short versions (i.e. -fBgoZ is the same as -f -B -g -o -Z)
  • -
  • Optionally supports multiple occurrences (i.e. myprog -vvv or myprog -v -v -v)
  • +
  • Optionally supports multiple occurrences (i.e. -vvv or -v -v -v)
  • Positional Arguments (i.e. those which are based off an index from the program name) @@ -89,7 +89,7 @@
    • Both short and long versions supported (i.e. -o value and --option value or --option=value respectively)
    • -
    • Optionally supports multiple values (i.e. myprog -o <value> -o <other_value>)
    • +
    • Optionally supports multiple values (i.e. -o <value> -o <other_value>)
    • Optionally supports Specific Value Sets (See below)
  • Sub-Commands (i.e. git add <file> where add is a sub-command of git) @@ -105,12 +105,17 @@
  • Required only if certain arguments are present
  • Can require other arguments to be present
  • -
  • Exclusion Rules: Arguments can optionally define the following types of exclusion rules +
  • Exclusion/Confliction Rules: Arguments can optionally define the following types of exclusion rules
    • Can be disallowed when certain arguments are present
    • Can disallow use of other arguments when present
  • +
  • Groups: Arguments can optionally be made part of a group which means one, and only one argument from this "group" may be present at runtime + +
      +
    • Fully compatible with other relational rules (requirements and exclusions) which allows things like requiring the use of a group, or denying the use of a group conditionally
    • +
  • Specific Value Sets: Positional or Option Arguments can optionally define a specific set of allowed values (i.e. imagine a --mode option which may only have one of two values fast or slow such as --mode fast or --mode slow)
  • Default Values: Although not specifically provided by clap you can achieve this exact functionality from Rust's Option<&str>.unwrap_or("some default") method (or Result<T,String>.unwrap_or(T) when using typed values)
  • Automatic Version from Cargo.toml: clap is fully compatible with Rust's env!() macro for automatically setting the version of your application to the version in your Cargo.toml. See examples/09_AutoVersion.rs for how to do this (Thanks to jhelwig for pointing this out)
  • @@ -119,11 +124,14 @@

    Quick Example

    -

    The following two examples show a quick example of some of the very basic functionality of clap. For more advanced usage, such as requirements, exclusions, multiple values and occurrences see the video tutorials, documentation, or examples/ directory of this repository.

    +

    The following two examples show a quick example of some of the very basic functionality of clap. For more advanced usage, such as requirements, exclusions, groups, multiple values and occurrences see the video tutorials, documentation, or examples/ directory of this repository.

    -

    NOTE: Both examples are functionally the same, but show two different ways to use clap

    +

    NOTE: Both examples are functionally the same, but show two different styles in which to use clap

     // (Full example with detailed comments in examples/01a_QuickExample.rs)
    +//
    +// This example demonstrates clap's "usage strings" method of creating arguments which is less
    +// less verbose
     extern crate clap;
     use clap::{Arg, App, SubCommand};
      
    @@ -177,6 +185,10 @@
     

    The following example is functionally the same as the one above, but this method allows more advanced configuration options (not shown in this small example), or even dynamically generating arguments when desired. Both methods can be used together to get the best of both worlds (see the documentation, examples, or video tutorials).

     // (Full example with detailed comments in examples/01b_QuickExample.rs)
    +//
    +// This example demonstrates clap's full 'builder pattern' style of creating arguments which is 
    +// more verbose, but allows easier editting, and at times more advanced options, or the possibility
    +// to generate arguments dynamically.
     extern crate clap;
     use clap::{Arg, App, SubCommand};
      
    @@ -254,7 +266,7 @@ FLAGS:
         -v, --version    Prints version information
       
     OPTIONS:
    -    -c, --config=CONFIG    Sets a custom config file
    +    -c, --config <CONFIG>    Sets a custom config file
      
     POSITIONAL ARGUMENTS:
         INPUT    The input file to use
    @@ -266,9 +278,42 @@ SUBCOMMANDS:
     
     

    NOTE: You could also run myapp test --help to see similar output and options for the test subcommand.

    -

    Installation

    -

    Add clap as a dependecy in your Cargo.toml file to use from crates.io:

    +

    Try it!

    +

    Pre-Built Test

    +

    To try out the pre-built example use the following stes:

    + +
      +
    • Clone the repostiory $ git clone https://github.com/kbknapp/clap-rs && cd clap-rs/clap-tests
    • +
    • Compile the example $ cargo build --release
    • +
    • Run the help info $ ./target/release/claptests --help
    • +
    • Play with the arguments!
    • +
    + +

    BYOB (Build Your Own Binary)

    +

    To test out clap's default auto-generated help/version follow these steps +* Create a new cargo project $ cargo new fake --bin && cd fake +* Add clap to your Cargo.toml $ echo '[dependencies]\nclap = "*"' >> Cargo.toml +* Add the following to your src/main.rs

    +
    +extern crate clap;
    +use clap::App;
    + 
    +fn main() {
    +  let _ = App::new("fake").version("v1.0-beta").get_matches();
    +}
    +
    + +
      +
    • Build your program $ cargo build --release
    • +
    • Run with help or version $ ./target/release/fake --help or $ ./target/release/fake --version
    • +
    + +

    Usage

    +

    For full usage, add clap as a dependecy in your Cargo.toml file to use from crates.io:

      [dependencies]
      clap = "*"
    @@ -363,89 +408,108 @@ SUBCOMMANDS:
     

    clap is licensed under the MIT license. Please the LICENSE-MIT file in this repository for more information.

    Macros

    - - - + + - - - + - - - + + - - - + + - - - + +
    + arg_enum!

    Convenience macro to generate more complete enums with variants to be used as a type when parsing +

    +

    Convenience macro to generate more complete enums with variants to be used as a type when parsing arguments.

    -
    + crate_version!

    Allows you pull the version for an from your Cargo.toml as MAJOR.MINOR.PATCH_PKGVERSION_PRE

    -
    +

    Allows you pull the version for an from your Cargo.toml as MAJOR.MINOR.PATCH_PKGVERSION_PRE

    + +
    + simple_enum!

    Convenience macro generated a simple enum with variants to be used as a type when parsing +

    +

    Convenience macro generated a simple enum with variants to be used as a type when parsing arguments.

    -
    + value_t!

    Convenience macro getting a typed value T where T implements std::str::FromStr +

    +

    Convenience macro getting a typed value T where T implements std::str::FromStr This macro returns a Result<T,String> which allows you as the developer to decide what you'd like to do on a failed parse. There are two types of errors, parse failures and those where the argument wasn't present (such as a non-required argument).

    -
    + value_t_or_exit!

    Convenience macro getting a typed value T where T implements std::str::FromStr +

    +

    Convenience macro getting a typed value T where T implements std::str::FromStr This macro returns a T or Vec<T> or exits with a usage string upon failure. This removes some of the boiler plate to handle failures from value_t! above.

    -

    Structs

    - - - + + - - - + + - - - + - - - + + - - - +
    + App

    Used to create a representation of a command line program and all possible command line +

    +

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

    -
    + Arg

    The abstract representation of a command line argument used by the consumer of the library. +

    +

    The abstract representation of a command line argument used by the consumer of the library. Used to set all the options and relationships that define a valid argument for the program.

    -
    + ArgGroup

    ArgGroups are a family of related arguments and provide a few useful features for you. By -placing arguments in a logical group, you can make easier requirement and exclusion rules. For -instance, you can make an ArgGroup required, this means that one (and only one) argument -from that group must be present. Using more than one argument from an ArgGroup causes a -failure (graceful exit).

    -
    +

    ArgGroups are a family of related arguments and way for you to say, "Any of these arguments". +By placing arguments in a logical group, you can make easier requirement and exclusion rules +intead of having to list each individually, or when you want a rule to apply "any but not all" +arguments.

    + +
    + ArgMatches

    Used to get information about the arguments that where supplied to the program at runtime by +

    +

    Used to get information about the arguments that where supplied to the program at runtime by the user. To get a new instance of this struct you use .get_matches() of the App struct.

    -
    + SubCommand

    The abstract representation of a command line subcommand used by the consumer of the library.

    -
    +

    The abstract representation of a command line subcommand used by the consumer of the library.

    + +
    diff --git a/docs/clap/macro.arg_enum!.html b/docs/clap/macro.arg_enum!.html index a1100eb3..c5eb48fe 100644 --- a/docs/clap/macro.arg_enum!.html +++ b/docs/clap/macro.arg_enum!.html @@ -41,9 +41,9 @@
    -

    clap::arg_enum! - [-] [+] - [src]

    +

    clap::arg_enum! + [-] + [src]

     macro_rules! arg_enum {
     	(enum $e:ident { $($v:ident),+ } ) => {
    diff --git a/docs/clap/macro.crate_version!.html b/docs/clap/macro.crate_version!.html
    index ba97e6ee..745cef9f 100644
    --- a/docs/clap/macro.crate_version!.html
    +++ b/docs/clap/macro.crate_version!.html
    @@ -41,9 +41,9 @@
         
     
         
    -

    clap::crate_version! - [-] [+] - [src]

    +

    clap::crate_version! + [-] + [src]

     macro_rules! crate_version {
     	() => {
    diff --git a/docs/clap/macro.simple_enum!.html b/docs/clap/macro.simple_enum!.html
    index 82f32a22..7d8106c7 100644
    --- a/docs/clap/macro.simple_enum!.html
    +++ b/docs/clap/macro.simple_enum!.html
    @@ -41,9 +41,9 @@
         
     
         
    -

    clap::simple_enum! - [-] [+] - [src]

    +

    clap::simple_enum! + [-] + [src]

     macro_rules! simple_enum {
     	($e:ident => $($v:ident),+) => {
    diff --git a/docs/clap/macro.value_t!.html b/docs/clap/macro.value_t!.html
    index 113edabb..d46cd3ff 100644
    --- a/docs/clap/macro.value_t!.html
    +++ b/docs/clap/macro.value_t!.html
    @@ -41,9 +41,9 @@
         
     
         
    -

    clap::value_t! - [-] [+] - [src]

    +

    clap::value_t! + [-] + [src]

     macro_rules! value_t {
     	($m:ident.value_of($v:expr), $t:ty) => {
    diff --git a/docs/clap/macro.value_t_or_exit!.html b/docs/clap/macro.value_t_or_exit!.html
    index e8573ca8..9f7ec93b 100644
    --- a/docs/clap/macro.value_t_or_exit!.html
    +++ b/docs/clap/macro.value_t_or_exit!.html
    @@ -41,9 +41,9 @@
         
     
         
    -

    clap::value_t_or_exit! - [-] [+] - [src]

    +

    clap::value_t_or_exit! + [-] + [src]

     macro_rules! value_t_or_exit {
     	($m:ident.value_of($v:expr), $t:ty) => {
    diff --git a/docs/clap/sidebar-items.js b/docs/clap/sidebar-items.js
    index 0f240036..adccd634 100644
    --- a/docs/clap/sidebar-items.js
    +++ b/docs/clap/sidebar-items.js
    @@ -1 +1 @@
    -initSidebarItems({"struct":[["App","Used to create a representation of a command line program and all possible command line arguments for parsing at runtime."],["Arg","The abstract representation of a command line argument used by the consumer of the library. Used to set all the options and relationships that define a valid argument for the program."],["ArgGroup","ArgGroups are a family of related arguments and provide a few useful features for you. By placing arguments in a logical group, you can make easier requirement and exclusion rules. For  instance, you can make an ArgGroup required, this means that one (and *only* one) argument from that group must be present. Using more than one argument from an ArgGroup causes a  failure (graceful exit)."],["ArgMatches","Used to get information about the arguments that where supplied to the program at runtime by the user. To get a new instance of this struct you use `.get_matches()` of the `App` struct."],["SubCommand","The abstract representation of a command line subcommand used by the consumer of the library."]],"macro":[["arg_enum!","Convenience macro to generate more complete enums with variants to be used as a type when parsing  arguments."],["crate_version!","Allows you pull the version for an from your Cargo.toml as MAJOR.MINOR.PATCH_PKGVERSION_PRE"],["simple_enum!","Convenience macro generated a simple enum with variants to be used as a type when parsing  arguments."],["value_t!","Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`  This macro returns a `Result` which allows you as the developer to decide  what you'd like to do on a failed parse. There are two types of errors, parse failures  and those where the argument wasn't present (such as a non-required argument). "],["value_t_or_exit!","Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`  This macro returns a `T` or `Vec` or exits with a usage string upon failure. This  removes some of the boiler plate to handle failures from value_t! above. "]]});
    \ No newline at end of file
    +initSidebarItems({"macro":[["arg_enum!","Convenience macro to generate more complete enums with variants to be used as a type when parsing  arguments."],["crate_version!","Allows you pull the version for an from your Cargo.toml as MAJOR.MINOR.PATCH_PKGVERSION_PRE"],["simple_enum!","Convenience macro generated a simple enum with variants to be used as a type when parsing  arguments."],["value_t!","Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`  This macro returns a `Result` which allows you as the developer to decide  what you'd like to do on a failed parse. There are two types of errors, parse failures  and those where the argument wasn't present (such as a non-required argument). "],["value_t_or_exit!","Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`  This macro returns a `T` or `Vec` or exits with a usage string upon failure. This  removes some of the boiler plate to handle failures from value_t! above. "]],"struct":[["App","Used to create a representation of a command line program and all possible command line arguments for parsing at runtime."],["Arg","The abstract representation of a command line argument used by the consumer of the library. Used to set all the options and relationships that define a valid argument for the program."],["ArgGroup","`ArgGroup`s are a family of related arguments and way for you to say, \"Any of these arguments\". By placing arguments in a logical group, you can make easier requirement and exclusion rules intead of having to list each individually, or when you want a rule to apply \"any but not all\" arguments. "],["ArgMatches","Used to get information about the arguments that where supplied to the program at runtime by the user. To get a new instance of this struct you use `.get_matches()` of the `App` struct."],["SubCommand","The abstract representation of a command line subcommand used by the consumer of the library."]]});
    \ No newline at end of file
    diff --git a/docs/clap/struct.App.html b/docs/clap/struct.App.html
    index e619d18f..addf424d 100644
    --- a/docs/clap/struct.App.html
    +++ b/docs/clap/struct.App.html
    @@ -41,9 +41,9 @@
         
     
         
    -

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

    +

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

    pub struct App<'a, 'v, 'ab, 'u, 'h, 'ar> {
         // some fields omitted
     }

    Used to create a representation of a command line program and all possible command line @@ -70,7 +70,7 @@ long as .get_matches() is last).

    // Your pogram logic starts here...
    -

    Methods

    impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    fn new(n: &'ar str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    Methods

    impl<'a, 'v, 'ab, 'u, 'h, 'ar> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    fn new(n: &'ar str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Creates a new instance of an application requiring a name (such as the binary). The name will be displayed to the user when they request to print version or help and usage information. The name should not contain spaces (hyphens '-' are ok).

    @@ -79,7 +79,7 @@ information. The name should not contain spaces (hyphens '-' are ok).

    Example
     let prog = App::new("myprog")
     
    -

    fn author(self, a: &'a str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn author(self, a: &'a str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Sets a string of author(s) and will be displayed to the user when they request the version or help information.

    @@ -87,7 +87,7 @@ or help information.

    href="#example">Example
     .author("Kevin <kbknapp@gmail.com>")
     
    -

    fn about(self, a: &'ab str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn about(self, a: &'ab str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Sets a string briefly describing what the program does and will be displayed when displaying help information.

    @@ -95,7 +95,7 @@ displaying help information.

    href="#example">Example
     .about("Does really amazing things to great people")
     
    -

    fn after_help(self, h: &'h str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn after_help(self, h: &'h str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Adds additional help information to be displayed in addition to and directly after auto-generated help. This information is displayed after the auto-generated help information. This additional help is often used to describe how to use the arguments, @@ -105,7 +105,7 @@ or caveats to be noted.

    href="#example">Example
     .after_help("Does really amazing things to great people")
     
    -

    fn version(self, v: &'v str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn version(self, v: &'v str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Sets a string of the version number to be displayed when displaying version or help information.

    @@ -113,7 +113,7 @@ information.

    href="#example">Example
     .version("v0.1.24")
     
    -

    fn usage(self, u: &'u str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn usage(self, u: &'u str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Sets a custom usage string to over-ride the auto-generated usage string. Will be displayed to the user when errors are found in argument parsing, or when you call ArgMatches::usage()

    @@ -129,7 +129,7 @@ showing the usage.

    href="#example">Example
     .usage("myapp [-clDas] <some_file>")
     
    -

    fn arg(self, a: Arg<'ar, 'ar, 'ar, 'ar, 'ar, 'ar>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn arg(self, a: Arg<'ar, 'ar, 'ar, 'ar, 'ar, 'ar>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Adds an argument to the list of valid possibilties manually. This method allows you full control over the arguments settings and options (as well as dynamic generation). It also allows you specify several more advanced configuration options such as relational rules @@ -148,7 +148,7 @@ control over the advanced configuration options.

    // Adding a single "option" argument with a short, a long, and help text using the less verbose Arg::from_usage() .arg(Arg::from_usage("-c --config=[CONFIG] 'Optionally sets a configuration file to use'"))
    -

    fn args(self, args: Vec<Arg<'ar, 'ar, 'ar, 'ar, 'ar, 'ar>>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn args(self, args: Vec<Arg<'ar, 'ar, 'ar, 'ar, 'ar, 'ar>>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    -

    fn arg_from_usage(self, usage: &'ar str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn arg_from_usage(self, usage: &'ar str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    A convienience method for adding a single basic argument (one without advanced relational rules) from a usage type string. The string used follows the same rules and syntax as Arg::from_usage()

    @@ -167,7 +167,7 @@ from a usage type string. The string used follows the same rules and syntax as < href="#example">Example
     .arg_from_usage("-c --conf=<config> 'Sets a configuration file to use'")
     
    -

    fn args_from_usage(self, usage: &'ar str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn args_from_usage(self, usage: &'ar str) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Adds multiple arguments at once from a usage string, one per line. See Arg::from_usage() for details on the syntax and rules supported.

    @@ -182,7 +182,7 @@ greatly enhanced, especially if you don't need any of the more advanced conf [debug]... -d 'Sets the debugging level' <input> 'The input file to use'")
    -

    fn arg_group(self, group: ArgGroup<'ar, 'ar>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn arg_group(self, group: ArgGroup<'ar, 'ar>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Adds an ArgGroup to the application. ArgGroups are a family of related arguments. By placing them in a logical group, you make easier requirement and exclusion rules. For instance, you can make an ArgGroup required, this means that one (and only one) argument @@ -211,7 +211,7 @@ group

    .add_all(vec!["ver", "major", "minor","patch"]) .required(true))
    -

    fn arg_groups(self, groups: Vec<ArgGroup<'ar, 'ar>>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn arg_groups(self, groups: Vec<ArgGroup<'ar, 'ar>>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Adds a ArgGroups to the application. ArgGroups are a family of related arguments. By placing them in a logical group, you make easier requirement and exclusion rules. For instance, you can make an ArgGroup required, this means that one (and only one) argument @@ -240,7 +240,7 @@ group

    .add_all(vec!["ver", "major", "minor","patch"]) .required(true)) -

    fn subcommand(self, subcmd: App<'a, 'v, 'ab, 'u, 'h, 'ar>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn subcommand(self, subcmd: App<'a, 'v, 'ab, 'u, 'h, 'ar>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Adds a subcommand to the list of valid possibilties. Subcommands are effectively sub apps, because they can contain their own arguments, subcommands, version, usage, etc. They also function just like apps, in that they get their own auto generated help, version, and usage.

    @@ -252,7 +252,7 @@ function just like apps, in that they get their own auto generated help, version .arg_from_usage("<config> 'Required configuration file to use'")) // Additional subcommand configuration goes here, such as other arguments... -

    fn subcommands(self, subcmds: Vec<App<'a, 'v, 'ab, 'u, 'h, 'ar>>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    +

    fn subcommands(self, subcmds: Vec<App<'a, 'v, 'ab, 'u, 'h, 'ar>>) -> App<'a, 'v, 'ab, 'u, 'h, 'ar>

    Adds multiple subcommands to the list of valid possibilties by iterating over a Vec of SubCommands

    arg(Arg::with_name("config_file").index(1)), SubCommand::new("debug").about("Controls debug functionality")]) -

    fn get_matches(self) -> ArgMatches<'ar, 'ar>

    +

    fn get_matches(self) -> ArgMatches<'ar, 'ar>

    diff --git a/docs/clap/struct.Arg.html b/docs/clap/struct.Arg.html index e836ea18..5e22884c 100644 --- a/docs/clap/struct.Arg.html +++ b/docs/clap/struct.Arg.html @@ -41,9 +41,9 @@
    -

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

    +

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

    pub struct Arg<'n, 'l, 'h, 'g, 'p, 'r> {
         // some fields omitted
     }

    The abstract representation of a command line argument used by the consumer of the library. @@ -68,7 +68,7 @@ of the two methods to achieve the best of both worlds.

    // Using a usage string (setting a similar argument to the one above) Arg::from_usage("-i --input=[input] 'Provides an input file to the program'") -

    Methods

    impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    fn new(n: &'n str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    Methods

    impl<'n, 'l, 'h, 'g, 'p, 'r> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    fn new(n: &'n str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Creates a new instace of Arg using a unique string name. The name will be used by the library consumer to get information about whether or not the argument was used at runtime.

    @@ -84,7 +84,7 @@ Rust APIs

    href="#example">Example
     Arg::new("conifg")
     
    -

    fn with_name(n: &'n str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn with_name(n: &'n str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Creates a new instace of Arg using a unique string name. The name will be used by the library consumer to get information about whether or not the argument was used at runtime.

    @@ -97,7 +97,7 @@ be displayed when the user prints the usage/help information of the program.

    href="#example">Example
     Arg::with_name("conifg")
     
    -

    fn from_usage(u: &'n str) -> Arg<'n, 'n, 'n, 'g, 'p, 'r>

    +

    fn from_usage(u: &'n str) -> Arg<'n, 'n, 'n, 'g, 'p, 'r>

    Creates a new instace of Arg from a usage string. Allows creation of basic settings for Arg (i.e. everything except relational rules). The syntax is flexible, but there are some rules to follow.

    @@ -144,7 +144,7 @@ specify one) i.e. all arguments without a short or longArg::from_usage("<input> 'the input file to use'") ]) -

    fn short(self, s: &str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn short(self, s: &str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets the short version of the argument without the preceding -.

    By default clap automatically assigns v and h to display version and help information @@ -158,7 +158,7 @@ non - chacter will be used as the short version

    href="#example">Example
     .short("c")
     
    -

    fn long(self, l: &'l str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn long(self, l: &'l str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets the long version of the argument without the preceding --.

    By default clap automatically assigns version and help to display version and help information @@ -172,7 +172,7 @@ so manually.

    href="#example">Example
     .long("config")
     
    -

    fn help(self, h: &'h str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn help(self, h: &'h str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets the help text of the argument that will be displayed to the user when they print the usage/help information.

    @@ -180,7 +180,7 @@ when they print the usage/help information.

    href="#example">Example
     .help("The config file used by the myprog")
     
    -

    fn required(self, r: bool) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn required(self, r: bool) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets whether or not the argument is required by default. Required by default means it is required, when no other mutually exlusive rules have been evaluated. Mutually exclusive rules take precedence over being required @@ -194,7 +194,7 @@ when they print the usage/help information.

    href="#example">Example
     .required(true)
     
    -

    fn mutually_excludes(self, name: &'r str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn mutually_excludes(self, name: &'r str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets a mutually exclusive argument by name. I.e. when using this argument, the following argument can't be present.

    @@ -208,7 +208,7 @@ arguments, they do not need to be set for each.

    href="#example">Example
     .mutually_excludes("debug")
     
    -

    fn mutually_excludes_all(self, names: Vec<&'r str>) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn mutually_excludes_all(self, names: Vec<&'r str>) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets a mutually exclusive arguments by names. I.e. when using this argument, the following argument can't be present.

    @@ -223,7 +223,7 @@ arguments, they do not need to be set for each.

    .mutually_excludes_all( vec!["debug", "input"]) -

    fn conflicts_with(self, name: &'r str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn conflicts_with(self, name: &'r str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets a mutually exclusive argument by name. I.e. when using this argument, the following argument can't be present.

    @@ -235,7 +235,7 @@ arguments, they do not need to be set for each.

    href="#example">Example
     .conflicts_with("debug")
     
    -

    fn conflicts_with_all(self, names: Vec<&'r str>) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn conflicts_with_all(self, names: Vec<&'r str>) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets mutually exclusive arguments by names. I.e. when using this argument, the following argument can't be present.

    @@ -248,7 +248,7 @@ arguments, they do not need to be set for each.

    .conflicts_with_all( vec!["debug", "input"]) -

    fn requires(self, name: &'r str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn requires(self, name: &'r str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets an argument by name that is required when this one is presnet I.e. when using this argument, the following argument must be present.

    @@ -258,7 +258,7 @@ using this argument, the following argument must be present.

    href="#example">Example
     .requires("debug")
     
    -

    fn requires_all(self, names: Vec<&'r str>) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn requires_all(self, names: Vec<&'r str>) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Sets arguments by names that are required when this one is presnet I.e. when using this argument, the following arguments must be present.

    @@ -270,7 +270,7 @@ by default.

    .requires_all( vec!["debug", "input"]) -

    fn takes_value(self, tv: bool) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn takes_value(self, tv: bool) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Specifies that the argument takes an additional value at run time.

    NOTE: When setting this to true the name of the argument @@ -280,7 +280,7 @@ will be used when printing the help/usage information to the user.

    href="#example">Example
     .takes_value(true)
     
    -

    fn index(self, idx: u8) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn index(self, idx: u8) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Specifies the index of a positional argument starting at 1.

    NOTE: When setting this, any short or long values you set @@ -292,7 +292,7 @@ to the user.

    href="#example">Example
     .index(1)
     
    -

    fn multiple(self, multi: bool) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn multiple(self, multi: bool) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Specifies if the flag may appear more than once such as for multiple debugging levels (as an example). -ddd for three levels of debugging, or -d -d -d. When this is set to true you recieve the number of occurances the user supplied @@ -305,7 +305,7 @@ are ignored as flags cannot have a values or an index.

    href="#example">Example
     .multiple(true)
     
    -

    fn possible_values(self, names: Vec<&'p str>) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn possible_values(self, names: Vec<&'p str>) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Specifies a list of possible values for this argument. At runtime, clap verifies that only one of the specified values was used, or fails with a usage string.

    @@ -315,7 +315,7 @@ one of the specified values was used, or fails with a usage string.

    href="#example">Example
     .possible_values(vec!["fast", "slow"])
     
    -

    fn group(self, name: &'g str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    +

    fn group(self, name: &'g str) -> Arg<'n, 'l, 'h, 'g, 'p, 'r>

    Specifies the name of the group the argument belongs to.

    -

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

    +

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

    pub struct ArgGroup<'n, 'ar> {
         // some fields omitted
    -}

    ArgGroups are a family of related arguments and provide a few useful features for you. By -placing arguments in a logical group, you can make easier requirement and exclusion rules. For -instance, you can make an ArgGroup required, this means that one (and only one) argument -from that group must be present. Using more than one argument from an ArgGroup causes a -failure (graceful exit).

    +}

    ArgGroups are a family of related arguments and way for you to say, "Any of these arguments". +By placing arguments in a logical group, you can make easier requirement and exclusion rules +intead of having to list each individually, or when you want a rule to apply "any but not all" +arguments.

    + +

    For instance, you can make an entire ArgGroup required, this means that one (and only one) +argument. from that group must be present. Using more than one argument from an ArgGroup causes +a failure (graceful exit).

    You can also do things such as name an ArgGroup as a confliction or requirement, meaning any of the arguments that belong to that group will cause a failure if present, or must present respectively.

    -

    Perhaps the most common use of ArgGroups is to require one and only one argument to be -present out of a given set. For example, lets say that you were building an application -where one could set a given version number by supplying a string using an option argument, -such as --set-ver v1.2.3, you also wanted to support automatically using a previous -version numer and simply incrementing one of the three numbers, so you create three flags ---major, --minor, and --patch. All of these arguments shouldn't be used at one time -but perhaps you want to specify that at least one of them is used. You can create a -group

    +

    Perhaps the most common use of ArgGroups is to require one and only one argument to be +present out of a given set. Imagine that you had multiple arguments, and you want one of them to +be required, but making all of them required isn't feasible because perhaps they conflict with +each other. For example, lets say that you were building an application where one could set a +given version number by supplying a string with an option argument, i.e. --set-ver v1.2.3, you +also wanted to support automatically using a previous version number and simply incrementing one +of the three numbers. So you create three flags --major, --minor, and --patch. All of +these arguments shouldn't be used at one time but you want to specify that at least one of +them is used. For this, you can create a group.

    Example

    +let _ = App::new("app")
     .args_from_usage("--set-ver [ver] 'set the version manually'
                       --major         'auto increase major'
                       --minor         'auto increase minor'
    @@ -75,7 +80,7 @@ group

    .add_all(vec!["ver", "major", "minor","patch"]) .required(true))
    -

    Methods

    impl<'n, 'ar> ArgGroup<'n, 'ar>

    fn with_name(n: &'n str) -> ArgGroup<'n, 'ar>

    +

    Methods

    impl<'n, 'ar> ArgGroup<'n, 'ar>

    fn with_name(n: &'n str) -> ArgGroup<'n, 'ar>

    Creates a new instace of ArgGroup using a unique string name. The name will only be used by the library consumer and not displayed to the user

    @@ -83,21 +88,21 @@ The name will only be used by the library consumer and not displayed to the user href="#example">Example

     ArgGroup::with_name("conifg")
     
    -

    fn add(self, n: &'ar str) -> ArgGroup<'n, 'ar>

    +

    fn add(self, n: &'ar str) -> ArgGroup<'n, 'ar>

    Adds an argument to this group by name

    Example

     .add("config")
     
    -

    fn add_all(self, ns: Vec<&'ar str>) -> ArgGroup<'n, 'ar>

    -

    Adds multiple arguments to this group by name inside a Vec

    +

    fn add_all(self, ns: Vec<&'ar str>) -> ArgGroup<'n, 'ar>

    +

    Adds multiple arguments to this group by name using a Vec

    Example

     .add_all(vec!["config", "input", "output"])
     
    -

    fn required(self, r: bool) -> ArgGroup<'n, 'ar>

    +

    fn required(self, r: bool) -> ArgGroup<'n, 'ar>

    Sets the requirement of this group. A required group will be displayed in the usage string of the application in the format [arg|arg2|arg3]. A required ArgGroup simply states that one, and only one argument from this group must be present at runtime (unless @@ -107,10 +112,10 @@ conflicting with another argument).

    href="#example">Example
     .required(true)
     
    -

    fn requires(self, n: &'ar str) -> ArgGroup<'n, 'ar>

    +

    fn requires(self, n: &'ar str) -> ArgGroup<'n, 'ar>

    Sets the requirement rules of this group. This is not to be confused with a required group. -Requirement rules function just like argument requirement rules, you can name other arguments -or groups that must be present when one of the arguments from this group is used.

    +Requirement rules function just like argument requirement rules, you can name other +arguments or groups that must be present when one of the arguments from this group is used.

    NOTE: The name provided may be an argument, or group name

    @@ -118,10 +123,10 @@ or groups that must be present when one of the arguments from this group is used href="#example">Example
     .requires("config")
     
    -

    fn requires_all(self, ns: Vec<&'ar str>) -> ArgGroup<'n, 'ar>

    +

    fn requires_all(self, ns: Vec<&'ar str>) -> ArgGroup<'n, 'ar>

    Sets the requirement rules of this group. This is not to be confused with a required group. -Requirement rules function just like argument requirement rules, you can name other arguments -or groups that must be present when one of the arguments from this group is used.

    +Requirement rules function just like argument requirement rules, you can name other +arguments or groups that must be present when one of the arguments from this group is used.

    NOTE: The names provided may be an argument, or group name

    @@ -129,10 +134,10 @@ or groups that must be present when one of the arguments from this group is used href="#example">Example
     .requires_all(vec!["config", "input"])
     
    -

    fn conflicts_with(self, n: &'ar str) -> ArgGroup<'n, 'ar>

    -

    Sets the exclusion rules of this group. Exclusion rules function just like argument exclusion -rules, you can name other arguments or groups that must not be present when one of the arguments -from this group are used.

    +

    fn conflicts_with(self, n: &'ar str) -> ArgGroup<'n, 'ar>

    +

    Sets the exclusion rules of this group. Exclusion rules function just like argument +exclusion rules, you can name other arguments or groups that must not be present when one +of the arguments from this group are used.

    NOTE: The name provided may be an argument, or group name

    @@ -140,10 +145,10 @@ from this group are used.

    href="#example">Example
     .conflicts_with("config")
     
    -

    fn conflicts_with_all(self, ns: Vec<&'ar str>) -> ArgGroup<'n, 'ar>

    -

    Sets the exclusion rules of this group. Exclusion rules function just like argument exclusion -rules, you can name other arguments or groups that must not be present when one of the arguments -from this group are used.

    +

    fn conflicts_with_all(self, ns: Vec<&'ar str>) -> ArgGroup<'n, 'ar>

    +

    Sets the exclusion rules of this group. Exclusion rules function just like argument +exclusion rules, you can name other arguments or groups that must not be present when one +of the arguments from this group are used.

    NOTE: The names provided may be an argument, or group name

    @@ -151,7 +156,7 @@ from this group are used.

    href="#example">Example
     .conflicts_with_all(vec!["config", "input"])
     
    -

    Trait Implementations

    impl<'n, 'ar> Debug for ArgGroup<'n, 'ar>

    fn fmt(&self, f: &mut Formatter) -> Result

    +

    Trait Implementations

    impl<'n, 'ar> Debug for ArgGroup<'n, 'ar>

    fn fmt(&self, f: &mut Formatter) -> Result

    diff --git a/docs/clap/struct.ArgMatches.html b/docs/clap/struct.ArgMatches.html index 425f2268..9e79dd05 100644 --- a/docs/clap/struct.ArgMatches.html +++ b/docs/clap/struct.ArgMatches.html @@ -41,9 +41,9 @@
    -

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

    +

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

    pub struct ArgMatches<'n, 'a> {
         // some fields omitted
     }

    Used to get information about the arguments that where supplied to the program at runtime by @@ -86,7 +86,7 @@ the user. To get a new instance of this struct you use .get_matches() -

    Methods

    impl<'n, 'a> ArgMatches<'n, 'a>

    fn value_of<'na>(&self, name: &'na str) -> Option<&str>

    +

    Methods

    impl<'n, 'a> ArgMatches<'n, 'a>

    fn value_of<'na>(&self, name: &'na str) -> Option<&str>

    Gets the value of a specific option or positional argument (i.e. an argument that takes an additional value at runtime). If the option wasn't present at runtime it returns None.

    @@ -100,7 +100,7 @@ prefer values_of() as value_of() will only return the println!("Value for output: {}", o); } -

    fn values_of<'na>(&'a self, name: &'na str) -> Option<Vec<&'a str>>

    +

    fn values_of<'na>(&'a self, name: &'na str) -> Option<Vec<&'a str>>

    Gets the values of a specific option or positional argument in a vector (i.e. an argument that takes multiple values at runtime). If the option wasn't present at runtime it returns None

    @@ -116,7 +116,7 @@ returns None

    } } -

    fn is_present<'na>(&self, name: &'na str) -> bool

    +

    fn is_present<'na>(&self, name: &'na str) -> bool

    Returns if an argument was present at runtime.

    None

    println!("The output argument was used!"); } -

    fn occurrences_of<'na>(&self, name: &'na str) -> u8

    +

    fn occurrences_of<'na>(&self, name: &'na str) -> u8

    Returns the number of occurrences of an option, flag, or positional argument at runtime. If an argument isn't present it will return 0. Can be used on arguments which don't allow multiple occurrences, but will obviously only return 0 or 1.

    @@ -138,7 +138,7 @@ allow multiple occurrences, but will obviously only return 0 or println!("Debug mode kind of on"); } -

    fn subcommand_matches<'na>(&self, name: &'na str) -> Option<&ArgMatches>

    +

    fn subcommand_matches<'na>(&self, name: &'na str) -> Option<&ArgMatches>

    Returns the ArgMatches for a particular subcommand or None if the subcommand wasn't present at runtime.

    @@ -148,7 +148,7 @@ present at runtime.

    // Use matches as normal } -

    fn subcommand_name(&self) -> Option<&str>

    +

    fn subcommand_name(&self) -> Option<&str>

    Returns the name of the subcommand used of the parent App, or None if one wasn't found

    NOTE: Only a single subcommand may be present per App at runtime, does NOT check for @@ -162,7 +162,7 @@ the name of sub-subcommand's names

    _ => {}, // Either no subcommand or one not tested for... } -

    fn subcommand(&self) -> (&str, Option<&ArgMatches>)

    +

    fn subcommand(&self) -> (&str, Option<&ArgMatches>)

    Returns the name and ArgMatches of the subcommand used at runtime or ("", None) if one wasn't found.

    @@ -174,7 +174,7 @@ wasn't found.

    _ => {}, // Either no subcommand or one not tested for... } -

    fn usage(&self) -> &str

    +

    fn usage(&self) -> &str

    Returns a string slice of the usage statement for the App (or SubCommand)

    -

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

    +

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

    pub struct SubCommand<'n, 'a> {
         pub name: &'n str,
         pub matches: ArgMatches<'n, 'a>,
    @@ -62,7 +62,9 @@ their own arguments and subcommands).

    .index(1))

    Fields

    -
    name
    matches

    Methods

    impl<'n, 'a> SubCommand<'n, 'a>

    fn new<'au, 'v, 'ab, 'u, 'h, 'ar>(name: &'ar str) -> App<'au, 'v, 'ab, 'u, 'h, 'ar>

    + + +
    name
    matches

    Methods

    impl<'n, 'a> SubCommand<'n, 'a>

    fn new<'au, 'v, 'ab, 'u, 'h, 'ar>(name: &'ar str) -> App<'au, 'v, 'ab, 'u, 'h, 'ar>

    Creates a new instance of a subcommand requiring a name. Will be displayed to the user when they print version or help and usage information.

    diff --git a/docs/implementors/core/fmt/trait.Debug.js b/docs/implementors/core/fmt/trait.Debug.js index 4de2fb2c..13f55340 100644 --- a/docs/implementors/core/fmt/trait.Debug.js +++ b/docs/implementors/core/fmt/trait.Debug.js @@ -1,5 +1,5 @@ (function() {var implementors = {}; -implementors['clap'] = ["impl<'n, 'ar> Debug for ArgGroup<'n, 'ar>",]; +implementors['clap'] = ["impl<'n, 'ar> Debug for ArgGroup<'n, 'ar>",]; if (window.register_implementors) { window.register_implementors(implementors); diff --git a/docs/main.css b/docs/main.css index 2af20ce5..c94dbc15 100644 --- a/docs/main.css +++ b/docs/main.css @@ -245,6 +245,10 @@ nav.sub { .content .highlighted.tymethod { background-color: #c6afb3; } .content .highlighted.type { background-color: #c6afb3; } +.docblock.short p { + display: inline; +} + .docblock.short.nowrap { display: block; overflow: hidden; @@ -337,11 +341,16 @@ nav.sub { /* Shift "where ..." part of method definition down a line */ .content .method .where { display: block; } /* Bit of whitespace to indent it */ -.content .method .where::before { content: ' '; } +.content .method .where::before { content: ' '; } -.content .methods .docblock { margin-left: 40px; } +.content .methods > div { margin-left: 40px; } -.content .impl-items .docblock { margin-left: 40px; } +.content .impl-items .docblock, .content .impl-items .stability { + margin-left: 40px; +} +.content .impl-items .method, .content .impl-items .type { + margin-left: 20px; +} nav { border-bottom: 1px solid #e0e0e0; @@ -468,31 +477,32 @@ a { padding: 20px; } -.stability { - border-left: 6px solid; - padding: 3px 6px; - border-radius: 3px; +em.stab.unstable { background: #FFF5D6; border-color: #FFC600; } +em.stab.deprecated { background: #F3DFFF; border-color: #7F0087; } +em.stab { + display: inline-block; + border-width: 1px; + border-style: solid; + padding: 3px; + margin-bottom: 5px; + font-size: 90%; + font-style: normal; +} +em.stab p { + display: inline; } -h1 .stability { - text-transform: lowercase; - font-weight: 400; - margin-left: 14px; - padding: 4px 10px; +.module-item .stab { + border-width: 0; + padding: 0; + margin: 0; + background: inherit !important; } -.impl-items .stability, .methods .stability { - margin-right: 20px; +.module-item.unstable { + opacity: 0.65; } -.stability.Deprecated { border-color: #A071A8; color: #82478C; } -.stability.Experimental { border-color: #D46D6A; color: #AA3C39; } -.stability.Unstable { border-color: #D4B16A; color: #AA8439; } -.stability.Stable { border-color: #54A759; color: #2D8632; } -.stability.Frozen { border-color: #009431; color: #007726; } -.stability.Locked { border-color: #0084B6; color: #00668c; } -.stability.Unmarked { border-color: #BBBBBB; } - td.summary-column { width: 100%; } @@ -500,11 +510,6 @@ td.summary-column { .summary { padding-right: 0px; } -.summary.Deprecated { background-color: #A071A8; } -.summary.Experimental { background-color: #D46D6A; } -.summary.Unstable { background-color: #D4B16A; } -.summary.Stable { background-color: #54A759; } -.summary.Unmarked { background-color: #BBBBBB; } :target { background: #FDFFD3; } .line-numbers :target { background-color: transparent; } @@ -555,9 +560,9 @@ pre.rust { position: relative; } .collapse-toggle { font-weight: 300; position: absolute; - left: 13px; + left: -23px; color: #999; - margin-top: 2px; + top: 0; } .toggle-wrapper > .collapse-toggle { diff --git a/docs/main.js b/docs/main.js index c3ab375a..56cea50a 100644 --- a/docs/main.js +++ b/docs/main.js @@ -802,24 +802,35 @@ if (query['gotosrc']) { window.location = $('#src-' + query['gotosrc']).attr('href'); } + if (query['gotomacrosrc']) { + window.location = $('.srclink').attr('href'); + } - $("#expand-all").on("click", function() { - $(".docblock").show(); - $(".toggle-label").hide(); - $(".toggle-wrapper").removeClass("collapsed"); - $(".collapse-toggle").children(".inner").html("-"); - }); - - $("#collapse-all").on("click", function() { - $(".docblock").hide(); - $(".toggle-label").show(); - $(".toggle-wrapper").addClass("collapsed"); - $(".collapse-toggle").children(".inner").html("+"); + $("#toggle-all-docs").on("click", function() { + var toggle = $("#toggle-all-docs"); + if (toggle.html() == "[-]") { + toggle.html("[+]"); + toggle.attr("title", "expand all docs"); + $(".docblock").hide(); + $(".toggle-label").show(); + $(".toggle-wrapper").addClass("collapsed"); + $(".collapse-toggle").children(".inner").html("+"); + } else { + toggle.html("[-]"); + toggle.attr("title", "collapse all docs"); + $(".docblock").show(); + $(".toggle-label").hide(); + $(".toggle-wrapper").removeClass("collapsed"); + $(".collapse-toggle").children(".inner").html("-"); + } }); $(document).on("click", ".collapse-toggle", function() { var toggle = $(this); var relatedDoc = toggle.parent().next(); + if (relatedDoc.is(".stability")) { + relatedDoc = relatedDoc.next(); + } if (relatedDoc.is(".docblock")) { if (relatedDoc.is(":visible")) { relatedDoc.slideUp({duration:'fast', easing:'linear'}); @@ -840,9 +851,10 @@ .html("[-]"); $(".method").each(function() { - if ($(this).next().is(".docblock")) { - $(this).children().first().after(toggle.clone()); - } + if ($(this).next().is(".docblock") || + ($(this).next().is(".stability") && $(this).next().next().is(".docblock"))) { + $(this).children().first().after(toggle.clone()); + } }); var mainToggle = diff --git a/docs/search-index.js b/docs/search-index.js index fcfd5363..a4ca9eb3 100644 --- a/docs/search-index.js +++ b/docs/search-index.js @@ -1,3 +1,3 @@ var searchIndex = {}; -searchIndex['clap'] = {"items":[[0,"","clap","# clap",null,null],[3,"Arg","","The abstract representation of a command line argument used by the consumer of the library.\nUsed to set all the options and relationships that define a valid argument for the program.",null,null],[3,"SubCommand","","The abstract representation of a command line subcommand used by the consumer of the library.",null,null],[12,"name","","",0,null],[12,"matches","","",0,null],[3,"ArgMatches","","Used to get information about the arguments that where supplied to the program at runtime by\nthe user. To get a new instance of this struct you use `.get_matches()` of the `App` struct.",null,null],[3,"ArgGroup","","ArgGroups are a family of related arguments and provide a few useful features for you. By\nplacing arguments in a logical group, you can make easier requirement and exclusion rules. For \ninstance, you can make an ArgGroup required, this means that one (and *only* one) argument\nfrom that group must be present. Using more than one argument from an ArgGroup causes a \nfailure (graceful exit).",null,null],[3,"App","","Used to create a representation of a command line program and all possible command line\narguments for parsing at runtime.",null,null],[11,"new","","Creates a new instance of an application requiring a name (such as the binary). The name\nwill be displayed to the user when they request to print version or help and usage\ninformation. The name should not contain spaces (hyphens '-' are ok).",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"author","","Sets a string of author(s) and will be displayed to the user when they request the version\nor help information.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"about","","Sets a string briefly describing what the program does and will be displayed when\ndisplaying help information.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"after_help","","Adds additional help information to be displayed in addition to and directly after\nauto-generated help. This information is displayed **after** the auto-generated help\ninformation. This additional help is often used to describe how to use the arguments,\nor caveats to be noted.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"version","","Sets a string of the version number to be displayed when displaying version or help\ninformation.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"usage","","Sets a custom usage string to over-ride the auto-generated usage string. Will be\ndisplayed to the user when errors are found in argument parsing, or when you call\n`ArgMatches::usage()`",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"arg","","Adds an argument to the list of valid possibilties manually. This method allows you full\ncontrol over the arguments settings and options (as well as dynamic generation). It also\nallows you specify several more advanced configuration options such as relational rules\n(exclusions and requirements).",1,{"inputs":[{"name":"app"},{"name":"arg"}],"output":{"name":"app"}}],[11,"args","","Adds multiple arguments to the list of valid possibilties by iterating over a Vec of Args",1,{"inputs":[{"name":"app"},{"name":"vec"}],"output":{"name":"app"}}],[11,"arg_from_usage","","A convienience method for adding a single basic argument (one without advanced relational rules)\nfrom a usage type string. The string used follows the same rules and syntax as `Arg::from_usage()`",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"args_from_usage","","Adds multiple arguments at once from a usage string, one per line. See `Arg::from_usage()`\nfor details on the syntax and rules supported.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"arg_group","","Adds an ArgGroup to the application. ArgGroups are a family of related arguments. By\nplacing them in a logical group, you make easier requirement and exclusion rules. For \ninstance, you can make an ArgGroup required, this means that one (and *only* one) argument\nfrom that group must be present. Using more than one argument from an ArgGroup causes a \nfailure (graceful exit).",1,{"inputs":[{"name":"app"},{"name":"arggroup"}],"output":{"name":"app"}}],[11,"arg_groups","","Adds a ArgGroups to the application. ArgGroups are a family of related arguments. By\nplacing them in a logical group, you make easier requirement and exclusion rules. For \ninstance, you can make an ArgGroup required, this means that one (and *only* one) argument\nfrom that group must be present. Using more than one argument from an ArgGroup causes a \nfailure (graceful exit).",1,{"inputs":[{"name":"app"},{"name":"vec"}],"output":{"name":"app"}}],[11,"subcommand","","Adds a subcommand to the list of valid possibilties. Subcommands are effectively sub apps,\nbecause they can contain their own arguments, subcommands, version, usage, etc. They also\nfunction just like apps, in that they get their own auto generated help, version, and usage.",1,{"inputs":[{"name":"app"},{"name":"app"}],"output":{"name":"app"}}],[11,"subcommands","","Adds multiple subcommands to the list of valid possibilties by iterating over a Vec of `SubCommand`s",1,{"inputs":[{"name":"app"},{"name":"vec"}],"output":{"name":"app"}}],[11,"get_matches","","",1,{"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. ",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"with_name","","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. ",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"from_usage","","Creates a new instace of `Arg` from a usage string. Allows creation of basic settings\nfor Arg (i.e. everything except relational rules). The syntax is flexible, but there are\nsome rules to follow.",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"short","","Sets the short version of the argument without the preceding `-`.",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"long","","Sets the long version of the argument without the preceding `--`.",2,{"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. ",2,{"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.",2,{"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.",2,{"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.",2,{"inputs":[{"name":"arg"},{"name":"vec"}],"output":{"name":"arg"}}],[11,"conflicts_with","","Sets a mutually exclusive argument by name. I.e. when using this argument,\nthe following argument can't be present.",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"conflicts_with_all","","Sets mutually exclusive arguments by names. I.e. when using this argument,\nthe following argument can't be present.",2,{"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.",2,{"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.",2,{"inputs":[{"name":"arg"},{"name":"vec"}],"output":{"name":"arg"}}],[11,"takes_value","","Specifies that the argument takes an additional value at run time.",2,{"inputs":[{"name":"arg"},{"name":"bool"}],"output":{"name":"arg"}}],[11,"index","","Specifies the index of a positional argument starting at 1.",2,{"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.",2,{"inputs":[{"name":"arg"},{"name":"bool"}],"output":{"name":"arg"}}],[11,"possible_values","","Specifies a list of possible values for this argument. At runtime, clap verifies that only\none of the specified values was used, or fails with a usage string.",2,{"inputs":[{"name":"arg"},{"name":"vec"}],"output":{"name":"arg"}}],[11,"group","","Specifies the name of the group the argument belongs to.",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[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`. ",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"option"}}],[11,"values_of","","Gets the values of a specific option or positional argument in a vector (i.e. an argument\nthat takes multiple values at runtime). If the option wasn't present at runtime it\nreturns `None`",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"option"}}],[11,"is_present","","Returns if an argument was present at runtime.",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"bool"}}],[11,"occurrences_of","","Returns the number of occurrences of an option, flag, or positional argument at runtime.\nIf an argument isn't present it will return `0`. Can be used on arguments which *don't*\nallow multiple occurrences, but will obviously only return `0` or `1`.",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"u8"}}],[11,"subcommand_matches","","Returns the `ArgMatches` for a particular subcommand or None if the subcommand wasn't\npresent at runtime.",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"option"}}],[11,"subcommand_name","","Returns the name of the subcommand used of the parent `App`, or `None` if one wasn't found",3,{"inputs":[{"name":"argmatches"}],"output":{"name":"option"}}],[11,"subcommand","","Returns the name and `ArgMatches` of the subcommand used at runtime or (\"\", None) if one\nwasn't found.",3,null],[11,"usage","","Returns a string slice of the usage statement for the `App` (or `SubCommand`)",3,{"inputs":[{"name":"argmatches"}],"output":{"name":"str"}}],[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.",0,{"inputs":[{"name":"subcommand"},{"name":"str"}],"output":{"name":"app"}}],[11,"with_name","","Creates a new instace of `ArgGroup` using a unique string name.\nThe name will only be used by the library consumer and not displayed to the user",4,{"inputs":[{"name":"arggroup"},{"name":"str"}],"output":{"name":"arggroup"}}],[11,"add","","Adds an argument to this group by name",4,{"inputs":[{"name":"arggroup"},{"name":"str"}],"output":{"name":"arggroup"}}],[11,"add_all","","Adds multiple arguments to this group by name inside a Vec",4,{"inputs":[{"name":"arggroup"},{"name":"vec"}],"output":{"name":"arggroup"}}],[11,"required","","Sets the requirement of this group. A required group will be displayed in the usage string\nof the application in the format `[arg|arg2|arg3]`. A required `ArgGroup` simply states\nthat one, and only one argument from this group *must* be present at runtime (unless\nconflicting with another argument).",4,{"inputs":[{"name":"arggroup"},{"name":"bool"}],"output":{"name":"arggroup"}}],[11,"requires","","Sets the requirement rules of this group. This is not to be confused with a required group.\nRequirement rules function just like argument requirement rules, you can name other arguments\nor groups that must be present when one of the arguments from this group is used.",4,{"inputs":[{"name":"arggroup"},{"name":"str"}],"output":{"name":"arggroup"}}],[11,"requires_all","","Sets the requirement rules of this group. This is not to be confused with a required group.\nRequirement rules function just like argument requirement rules, you can name other arguments\nor groups that must be present when one of the arguments from this group is used.",4,{"inputs":[{"name":"arggroup"},{"name":"vec"}],"output":{"name":"arggroup"}}],[11,"conflicts_with","","Sets the exclusion rules of this group. Exclusion rules function just like argument exclusion\nrules, you can name other arguments or groups that must not be present when one of the arguments\nfrom this group are used.",4,{"inputs":[{"name":"arggroup"},{"name":"str"}],"output":{"name":"arggroup"}}],[11,"conflicts_with_all","","Sets the exclusion rules of this group. Exclusion rules function just like argument exclusion\nrules, you can name other arguments or groups that must not be present when one of the arguments\nfrom this group are used.",4,{"inputs":[{"name":"arggroup"},{"name":"vec"}],"output":{"name":"arggroup"}}],[11,"fmt","","",4,{"inputs":[{"name":"arggroup"},{"name":"formatter"}],"output":{"name":"result"}}],[14,"value_t!","","Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`\n This macro returns a `Result` which allows you as the developer to decide\n what you'd like to do on a failed parse. There are two types of errors, parse failures\n and those where the argument wasn't present (such as a non-required argument). ",null,null],[14,"value_t_or_exit!","","Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`\n This macro returns a `T` or `Vec` or exits with a usage string upon failure. This\n removes some of the boiler plate to handle failures from value_t! above. ",null,null],[14,"simple_enum!","","Convenience macro generated a simple enum with variants to be used as a type when parsing\n arguments.",null,null],[14,"arg_enum!","","Convenience macro to generate more complete enums with variants to be used as a type when parsing\n arguments.",null,null],[14,"crate_version!","","Allows you pull the version for an from your Cargo.toml as MAJOR.MINOR.PATCH_PKGVERSION_PRE",null,null]],"paths":[[3,"SubCommand"],[3,"App"],[3,"Arg"],[3,"ArgMatches"],[3,"ArgGroup"]]}; +searchIndex['clap'] = {"items":[[0,"","clap","# clap",null,null],[3,"Arg","","The abstract representation of a command line argument used by the consumer of the library.\nUsed to set all the options and relationships that define a valid argument for the program.",null,null],[3,"SubCommand","","The abstract representation of a command line subcommand used by the consumer of the library.",null,null],[12,"name","","",0,null],[12,"matches","","",0,null],[3,"ArgMatches","","Used to get information about the arguments that where supplied to the program at runtime by\nthe user. To get a new instance of this struct you use `.get_matches()` of the `App` struct.",null,null],[3,"ArgGroup","","`ArgGroup`s are a family of related arguments and way for you to say, \"Any of these arguments\".\nBy placing arguments in a logical group, you can make easier requirement and exclusion rules\nintead of having to list each individually, or when you want a rule to apply \"any but not all\"\narguments. ",null,null],[3,"App","","Used to create a representation of a command line program and all possible command line\narguments for parsing at runtime.",null,null],[11,"new","","Creates a new instance of an application requiring a name (such as the binary). The name\nwill be displayed to the user when they request to print version or help and usage\ninformation. The name should not contain spaces (hyphens '-' are ok).",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"author","","Sets a string of author(s) and will be displayed to the user when they request the version\nor help information.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"about","","Sets a string briefly describing what the program does and will be displayed when\ndisplaying help information.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"after_help","","Adds additional help information to be displayed in addition to and directly after\nauto-generated help. This information is displayed **after** the auto-generated help\ninformation. This additional help is often used to describe how to use the arguments,\nor caveats to be noted.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"version","","Sets a string of the version number to be displayed when displaying version or help\ninformation.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"usage","","Sets a custom usage string to over-ride the auto-generated usage string. Will be\ndisplayed to the user when errors are found in argument parsing, or when you call\n`ArgMatches::usage()`",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"arg","","Adds an argument to the list of valid possibilties manually. This method allows you full\ncontrol over the arguments settings and options (as well as dynamic generation). It also\nallows you specify several more advanced configuration options such as relational rules\n(exclusions and requirements).",1,{"inputs":[{"name":"app"},{"name":"arg"}],"output":{"name":"app"}}],[11,"args","","Adds multiple arguments to the list of valid possibilties by iterating over a Vec of Args",1,{"inputs":[{"name":"app"},{"name":"vec"}],"output":{"name":"app"}}],[11,"arg_from_usage","","A convienience method for adding a single basic argument (one without advanced relational rules)\nfrom a usage type string. The string used follows the same rules and syntax as `Arg::from_usage()`",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"args_from_usage","","Adds multiple arguments at once from a usage string, one per line. See `Arg::from_usage()`\nfor details on the syntax and rules supported.",1,{"inputs":[{"name":"app"},{"name":"str"}],"output":{"name":"app"}}],[11,"arg_group","","Adds an ArgGroup to the application. ArgGroups are a family of related arguments. By\nplacing them in a logical group, you make easier requirement and exclusion rules. For \ninstance, you can make an ArgGroup required, this means that one (and *only* one) argument\nfrom that group must be present. Using more than one argument from an ArgGroup causes a \nfailure (graceful exit).",1,{"inputs":[{"name":"app"},{"name":"arggroup"}],"output":{"name":"app"}}],[11,"arg_groups","","Adds a ArgGroups to the application. ArgGroups are a family of related arguments. By\nplacing them in a logical group, you make easier requirement and exclusion rules. For \ninstance, you can make an ArgGroup required, this means that one (and *only* one) argument\nfrom that group must be present. Using more than one argument from an ArgGroup causes a \nfailure (graceful exit).",1,{"inputs":[{"name":"app"},{"name":"vec"}],"output":{"name":"app"}}],[11,"subcommand","","Adds a subcommand to the list of valid possibilties. Subcommands are effectively sub apps,\nbecause they can contain their own arguments, subcommands, version, usage, etc. They also\nfunction just like apps, in that they get their own auto generated help, version, and usage.",1,{"inputs":[{"name":"app"},{"name":"app"}],"output":{"name":"app"}}],[11,"subcommands","","Adds multiple subcommands to the list of valid possibilties by iterating over a Vec of `SubCommand`s",1,{"inputs":[{"name":"app"},{"name":"vec"}],"output":{"name":"app"}}],[11,"get_matches","","",1,{"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. ",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"with_name","","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. ",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"from_usage","","Creates a new instace of `Arg` from a usage string. Allows creation of basic settings\nfor Arg (i.e. everything except relational rules). The syntax is flexible, but there are\nsome rules to follow.",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"short","","Sets the short version of the argument without the preceding `-`.",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"long","","Sets the long version of the argument without the preceding `--`.",2,{"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. ",2,{"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.",2,{"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.",2,{"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.",2,{"inputs":[{"name":"arg"},{"name":"vec"}],"output":{"name":"arg"}}],[11,"conflicts_with","","Sets a mutually exclusive argument by name. I.e. when using this argument,\nthe following argument can't be present.",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[11,"conflicts_with_all","","Sets mutually exclusive arguments by names. I.e. when using this argument,\nthe following argument can't be present.",2,{"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.",2,{"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.",2,{"inputs":[{"name":"arg"},{"name":"vec"}],"output":{"name":"arg"}}],[11,"takes_value","","Specifies that the argument takes an additional value at run time.",2,{"inputs":[{"name":"arg"},{"name":"bool"}],"output":{"name":"arg"}}],[11,"index","","Specifies the index of a positional argument starting at 1.",2,{"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.",2,{"inputs":[{"name":"arg"},{"name":"bool"}],"output":{"name":"arg"}}],[11,"possible_values","","Specifies a list of possible values for this argument. At runtime, clap verifies that only\none of the specified values was used, or fails with a usage string.",2,{"inputs":[{"name":"arg"},{"name":"vec"}],"output":{"name":"arg"}}],[11,"group","","Specifies the name of the group the argument belongs to.",2,{"inputs":[{"name":"arg"},{"name":"str"}],"output":{"name":"arg"}}],[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`. ",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"option"}}],[11,"values_of","","Gets the values of a specific option or positional argument in a vector (i.e. an argument\nthat takes multiple values at runtime). If the option wasn't present at runtime it\nreturns `None`",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"option"}}],[11,"is_present","","Returns if an argument was present at runtime.",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"bool"}}],[11,"occurrences_of","","Returns the number of occurrences of an option, flag, or positional argument at runtime.\nIf an argument isn't present it will return `0`. Can be used on arguments which *don't*\nallow multiple occurrences, but will obviously only return `0` or `1`.",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"u8"}}],[11,"subcommand_matches","","Returns the `ArgMatches` for a particular subcommand or None if the subcommand wasn't\npresent at runtime.",3,{"inputs":[{"name":"argmatches"},{"name":"str"}],"output":{"name":"option"}}],[11,"subcommand_name","","Returns the name of the subcommand used of the parent `App`, or `None` if one wasn't found",3,{"inputs":[{"name":"argmatches"}],"output":{"name":"option"}}],[11,"subcommand","","Returns the name and `ArgMatches` of the subcommand used at runtime or (\"\", None) if one\nwasn't found.",3,null],[11,"usage","","Returns a string slice of the usage statement for the `App` (or `SubCommand`)",3,{"inputs":[{"name":"argmatches"}],"output":{"name":"str"}}],[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.",0,{"inputs":[{"name":"subcommand"},{"name":"str"}],"output":{"name":"app"}}],[11,"with_name","","Creates a new instace of `ArgGroup` using a unique string name.\nThe name will only be used by the library consumer and not displayed to the user",4,{"inputs":[{"name":"arggroup"},{"name":"str"}],"output":{"name":"arggroup"}}],[11,"add","","Adds an argument to this group by name",4,{"inputs":[{"name":"arggroup"},{"name":"str"}],"output":{"name":"arggroup"}}],[11,"add_all","","Adds multiple arguments to this group by name using a Vec",4,{"inputs":[{"name":"arggroup"},{"name":"vec"}],"output":{"name":"arggroup"}}],[11,"required","","Sets the requirement of this group. A required group will be displayed in the usage string\nof the application in the format `[arg|arg2|arg3]`. A required `ArgGroup` simply states\nthat one, and only one argument from this group *must* be present at runtime (unless\nconflicting with another argument).",4,{"inputs":[{"name":"arggroup"},{"name":"bool"}],"output":{"name":"arggroup"}}],[11,"requires","","Sets the requirement rules of this group. This is not to be confused with a required group.\nRequirement rules function just like argument requirement rules, you can name other\narguments or groups that must be present when one of the arguments from this group is used.",4,{"inputs":[{"name":"arggroup"},{"name":"str"}],"output":{"name":"arggroup"}}],[11,"requires_all","","Sets the requirement rules of this group. This is not to be confused with a required group.\nRequirement rules function just like argument requirement rules, you can name other\narguments or groups that must be present when one of the arguments from this group is used.",4,{"inputs":[{"name":"arggroup"},{"name":"vec"}],"output":{"name":"arggroup"}}],[11,"conflicts_with","","Sets the exclusion rules of this group. Exclusion rules function just like argument\nexclusion rules, you can name other arguments or groups that must not be present when one\nof the arguments from this group are used.",4,{"inputs":[{"name":"arggroup"},{"name":"str"}],"output":{"name":"arggroup"}}],[11,"conflicts_with_all","","Sets the exclusion rules of this group. Exclusion rules function just like argument\nexclusion rules, you can name other arguments or groups that must not be present when one\nof the arguments from this group are used.",4,{"inputs":[{"name":"arggroup"},{"name":"vec"}],"output":{"name":"arggroup"}}],[11,"fmt","","",4,{"inputs":[{"name":"arggroup"},{"name":"formatter"}],"output":{"name":"result"}}],[14,"value_t!","","Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`\n This macro returns a `Result` which allows you as the developer to decide\n what you'd like to do on a failed parse. There are two types of errors, parse failures\n and those where the argument wasn't present (such as a non-required argument). ",null,null],[14,"value_t_or_exit!","","Convenience macro getting a typed value `T` where `T` implements `std::str::FromStr`\n This macro returns a `T` or `Vec` or exits with a usage string upon failure. This\n removes some of the boiler plate to handle failures from value_t! above. ",null,null],[14,"simple_enum!","","Convenience macro generated a simple enum with variants to be used as a type when parsing\n arguments.",null,null],[14,"arg_enum!","","Convenience macro to generate more complete enums with variants to be used as a type when parsing\n arguments.",null,null],[14,"crate_version!","","Allows you pull the version for an from your Cargo.toml as MAJOR.MINOR.PATCH_PKGVERSION_PRE",null,null]],"paths":[[3,"SubCommand"],[3,"App"],[3,"Arg"],[3,"ArgMatches"],[3,"ArgGroup"]]}; initSearch(searchIndex); diff --git a/docs/src/clap/args/group.rs.html b/docs/src/clap/args/group.rs.html index bf9cc3f1..456d081f 100644 --- a/docs/src/clap/args/group.rs.html +++ b/docs/src/clap/args/group.rs.html @@ -280,34 +280,44 @@ 238 239 240 +241 +242 +243 +244 +245
     use std::collections::HashSet;
     use std::fmt::{Debug, Formatter, Result};
     
    -/// ArgGroups are a family of related arguments and provide a few useful features for you. By 
    -/// placing arguments in a logical group, you can make easier requirement and exclusion rules. For 
    -/// instance, you can make an ArgGroup required, this means that one (and *only* one) argument
    -/// from that group must be present. Using more than one argument from an ArgGroup causes a 
    -/// failure (graceful exit).
    +/// `ArgGroup`s are a family of related arguments and way for you to say, "Any of these arguments".
    +/// By placing arguments in a logical group, you can make easier requirement and exclusion rules
    +/// intead of having to list each individually, or when you want a rule to apply "any but not all"
    +/// arguments. 
    +///
    +/// For instance, you can make an entire ArgGroup required, this means that one (and *only* one)
    +/// argument. from that group must be present. Using more than one argument from an ArgGroup causes
    +/// a failure (graceful exit).
     /// 
     /// You can also do things such as name an ArgGroup as a confliction or requirement, meaning any 
     /// of the arguments that belong to that group will cause a failure if present, or must present
     /// respectively.
     ///
    -/// Perhaps the most common use of ArgGroups is to require one and *only* one argument to be 
    -/// present out of a given set. For example, lets say that you were building an application
    -/// where one could set a given version number by supplying a string using an option argument,
    -/// such as `--set-ver v1.2.3`, you also wanted to support automatically using a previous
    -/// version numer and simply incrementing one of the three numbers, so you create three flags
    -/// `--major`, `--minor`, and `--patch`. All of these arguments shouldn't be used at one time
    -/// but perhaps you want to specify that *at least one* of them is used. You can create a
    -/// group
    +/// Perhaps the most common use of `ArgGroup`s is to require one and *only* one argument to be 
    +/// present out of a given set. Imagine that you had multiple arguments, and you want one of them to
    +/// be required, but making all of them required isn't feasible because perhaps they conflict with
    +/// each other. For example, lets say that you were building an application where one could set a
    +/// given version number by supplying a string with an option argument, i.e. `--set-ver v1.2.3`, you 
    +/// also wanted to support automatically using a previous version number and simply incrementing one
    +/// of the three numbers. So you create three flags `--major`, `--minor`, and `--patch`. All of
    +/// these arguments shouldn't be used at one time but you want to specify that *at least one* of
    +/// them is used. For this, you can create a group.
     ///
     ///
     /// # Example
    +///
     /// ```no_run
     /// # use clap::{App, ArgGroup};
    -/// # let _ = App::new("app")
    +/// let _ = App::new("app")
     /// .args_from_usage("--set-ver [ver] 'set the version manually'
     ///                   --major         'auto increase major'
     ///                   --minor         'auto increase minor'
    @@ -369,7 +379,7 @@
             self
         }
     
    -    /// Adds multiple arguments to this group by name inside a Vec
    +    /// Adds multiple arguments to this group by name using a Vec
         ///
         ///
         /// # Example
    @@ -409,8 +419,8 @@
         }
     
         /// Sets the requirement rules of this group. This is not to be confused with a required group.
    -    /// Requirement rules function just like argument requirement rules, you can name other arguments
    -    /// or groups that must be present when one of the arguments from this group is used.
    +    /// Requirement rules function just like argument requirement rules, you can name other
    +    /// arguments or groups that must be present when one of the arguments from this group is used.
         ///
         /// **NOTE:** The name provided may be an argument, or group name
         ///
    @@ -436,8 +446,8 @@
         }
     
         /// Sets the requirement rules of this group. This is not to be confused with a required group.
    -    /// Requirement rules function just like argument requirement rules, you can name other arguments
    -    /// or groups that must be present when one of the arguments from this group is used.
    +    /// Requirement rules function just like argument requirement rules, you can name other
    +    /// arguments or groups that must be present when one of the arguments from this group is used.
         ///
         /// **NOTE:** The names provided may be an argument, or group name
         ///
    @@ -458,9 +468,9 @@
             self
         }
     
    -    /// Sets the exclusion rules of this group. Exclusion rules function just like argument exclusion 
    -    /// rules, you can name other arguments or groups that must not be present when one of the arguments
    -    /// from this group are used.
    +    /// Sets the exclusion rules of this group. Exclusion rules function just like argument 
    +    /// exclusion rules, you can name other arguments or groups that must not be present when one
    +    /// of the arguments from this group are used.
         ///
         /// **NOTE:** The name provided may be an argument, or group name
         ///
    @@ -485,9 +495,9 @@
             self
         }
     
    -    /// Sets the exclusion rules of this group. Exclusion rules function just like argument exclusion 
    -    /// rules, you can name other arguments or groups that must not be present when one of the arguments
    -    /// from this group are used.
    +    /// Sets the exclusion rules of this group. Exclusion rules function just like argument
    +    /// exclusion rules, you can name other arguments or groups that must not be present when one
    +    /// of the arguments from this group are used.
         ///
         /// **NOTE:** The names provided may be an argument, or group name
         ///
    diff --git a/docs/src/clap/lib.rs.html b/docs/src/clap/lib.rs.html
    index c841571f..4ffd7695 100644
    --- a/docs/src/clap/lib.rs.html
    +++ b/docs/src/clap/lib.rs.html
    @@ -974,6 +974,44 @@
     932
     933
     934
    +935
    +936
    +937
    +938
    +939
    +940
    +941
    +942
    +943
    +944
    +945
    +946
    +947
    +948
    +949
    +950
    +951
    +952
    +953
    +954
    +955
    +956
    +957
    +958
    +959
    +960
    +961
    +962
    +963
    +964
    +965
    +966
    +967
    +968
    +969
    +970
    +971
    +972
     
     #![crate_type= "lib"]
     
    @@ -984,15 +1022,15 @@
     //! 
     //! Command Line Argument Parser for Rust
     //! 
    -//! It is a simple to use and efficient library for parsing command line arguments and subcommands when writing console, or terminal applications.
    +//! It is a simple to use, efficient, and full featured library for parsing command line arguments and subcommands when writing console, or terminal applications.
     //! 
     //! ## About
     //! 
    -//! `clap` is used to parse *and validate* the string of command line arguments provided by the user at runtime. You simply provide the list of valid possibilities, and `clap` handles the rest. This means you focus on your *applications* functionality, and less on the parsing and validating of arguments.
    +//! `clap` is used to parse *and validate* the string of command line arguments provided by the user at runtime. You provide the list of valid possibilities, and `clap` handles the rest. This means you focus on your *applications* functionality, and less on the parsing and validating of arguments.
     //! 
    -//! `clap` also provides all the traditional version and help switches (or flags) 'for free.' It does this by checking list of valid possibilities you supplied and if you haven't defined those flags already (or only defined some of them), `clap` will auto-generate the applicable ones (as well as a "help" subcommand so long as other subcommands have been manually defined as well).
    +//! `clap` also provides the traditional version and help switches (or flags) 'for free' meaning automatically with no configuration. It does this by checking list of valid possibilities you supplied and if you haven't them already (or only defined some of them), `clap` will auto-generate the applicable ones. If you are using subcommands, `clap` will also auto-generate a `help` subcommand for you in addition to the traditional flags.
     //! 
    -//! After `clap` finishes parsing the user provided string, it returns all the matches along with any applicable values. If the user made an error or typo, `clap` informs them of the mistake and exits gracefully. Because of this, you can make reasonable assumptions in your code, and worry less about error handling.
    +//! Once `clap` parses the user provided string of arguments, it returns the matches along with any applicable values. If the user made an error or typo, `clap` informs them of the mistake and exits gracefully. Because of this, you can make reasonable assumptions in your code about the validity of the arguments.
     //! 
     //! ## Features
     //! 
    @@ -1003,14 +1041,14 @@
     //! * **Flags / Switches** (i.e. bool fields)
     //!   - Both short and long versions supported (i.e. `-f` and `--flag` respectively)
     //!   - Supports combining short versions (i.e. `-fBgoZ` is the same as `-f -B -g -o -Z`)
    -//!   - Optionally supports multiple occurrences (i.e. `myprog -vvv` or `myprog -v -v -v`)
    +//!   - Optionally supports multiple occurrences (i.e. `-vvv` or `-v -v -v`)
     //! * **Positional Arguments** (i.e. those which are based off an index from the program name)
     //!   - Optionally supports multiple values (i.e. `myprog <file>...` such as `myprog file1.txt file2.txt` being two values for the same "file" argument)
     //!   - Optionally supports Specific Value Sets (See below)
     //!   - Supports the unix `--` meaning, only positional arguments follow
     //! * **Option Arguments** (i.e. those that take values as options)
     //!   - Both short and long versions supported (i.e. `-o value` and `--option value` or `--option=value` respectively)
    -//!   - Optionally supports multiple values (i.e. `myprog -o <value> -o <other_value>`)
    +//!   - Optionally supports multiple values (i.e. `-o <value> -o <other_value>`)
     //!   - Optionally supports Specific Value Sets (See below)
     //! * **Sub-Commands** (i.e. `git add <file>` where `add` is a sub-command of `git`)
     //!   - Support their own sub-arguments, and sub-sub-commands independant of the parent
    @@ -1019,9 +1057,11 @@
     //!   - Required by default
     //!   - Required only if certain arguments are present
     //!   - Can require other arguments to be present
    -//! * **Exclusion Rules**: Arguments can optionally define the following types of exclusion rules
    +//! * **Exclusion/Confliction Rules**: Arguments can optionally define the following types of exclusion rules
     //!   - Can be disallowed when certain arguments are present
     //!   - Can disallow use of other arguments when present
    +//! * **Groups**: Arguments can optionally be made part of a group which means one, and only one argument from this "group" may be present at runtime
    +//!   - Fully compatible with other relational rules (requirements and exclusions) which allows things like requiring the use of a group, or denying the use of a group conditionally
     //! * **Specific Value Sets**: Positional or Option Arguments can optionally define a specific set of allowed values (i.e. imagine a `--mode` option which may *only* have one of two values `fast` or `slow` such as `--mode fast` or `--mode slow`)
     //! * **Default Values**: Although not specifically provided by `clap` you can achieve this exact functionality from Rust's `Option<&str>.unwrap_or("some default")` method (or `Result<T,String>.unwrap_or(T)` when using typed values)
     //! * **Automatic Version from Cargo.toml**: `clap` is fully compatible with Rust's `env!()` macro for automatically setting the version of your application to the version in your Cargo.toml. See `examples/09_AutoVersion.rs` for how to do this (Thanks to [jhelwig](https://github.com/jhelwig) for pointing this out)
    @@ -1029,12 +1069,15 @@
     //! 
     //! ## Quick Example
     //!  
    -//! The following two examples show a quick example of some of the very basic functionality of `clap`. For more advanced usage, such as requirements, exclusions, multiple values and occurrences see the [video tutorials](https://www.youtube.com/playlist?list=PLza5oFLQGTl0Bc_EU_pBNcX-rhVqDTRxv), [documentation](http://kbknapp.github.io/clap-rs/docs/clap/index.html), or `examples/` directory of this repository.
    +//! The following two examples show a quick example of some of the very basic functionality of `clap`. For more advanced usage, such as requirements, exclusions, groups, multiple values and occurrences see the [video tutorials](https://www.youtube.com/playlist?list=PLza5oFLQGTl0Bc_EU_pBNcX-rhVqDTRxv), [documentation](http://kbknapp.github.io/clap-rs/docs/clap/index.html), or `examples/` directory of this repository.
     //!  
    -//!  *NOTE:* Both examples are functionally the same, but show two different ways to use `clap`
    +//!  *NOTE:* Both examples are functionally the same, but show two different styles in which to use `clap`
     //!  
     //! ```rust
     //! // (Full example with detailed comments in examples/01a_QuickExample.rs)
    +//! //
    +//! // This example demonstrates clap's "usage strings" method of creating arguments which is less
    +//! // less verbose
     //! extern crate clap;
     //! use clap::{Arg, App, SubCommand};
     //! 
    @@ -1089,6 +1132,10 @@
     //!  
     //! ```rust
     //! // (Full example with detailed comments in examples/01b_QuickExample.rs)
    +//! //
    +//! // This example demonstrates clap's full 'builder pattern' style of creating arguments which is 
    +//! // more verbose, but allows easier editting, and at times more advanced options, or the possibility
    +//! // to generate arguments dynamically.
     //! extern crate clap;
     //! use clap::{Arg, App, SubCommand};
     //! 
    @@ -1167,7 +1214,7 @@
     //!     -v, --version    Prints version information
     //!  
     //! OPTIONS:
    -//!     -c, --config=CONFIG    Sets a custom config file
    +//!     -c, --config <CONFIG>    Sets a custom config file
     //! 
     //! POSITIONAL ARGUMENTS:
     //!     INPUT    The input file to use
    @@ -1179,9 +1226,38 @@
     //! 
     //! *NOTE:* You could also run `myapp test --help` to see similar output and options for the `test` subcommand.
     //! 
    -//! ## Installation
    +//! ## Try it!
     //! 
    -//! Add `clap` as a dependecy in your `Cargo.toml` file to use from crates.io:
    +//! ### Pre-Built Test
    +//! 
    +//! To try out the pre-built example use the following stes:
    +//! 
    +//! * Clone the repostiory `$ git clone https://github.com/kbknapp/clap-rs && cd clap-rs/clap-tests`
    +//! * Compile the example `$ cargo build --release`
    +//! * Run the help info `$ ./target/release/claptests --help`
    +//! * Play with the arguments!
    +//! 
    +//! ### BYOB (Build Your Own Binary)
    +//! 
    +//! To test out `clap`'s default auto-generated help/version follow these steps
    +//! * Create a new cargo project `$ cargo new fake --bin && cd fake`
    +//! * Add `clap` to your `Cargo.toml` `$ echo '[dependencies]\nclap = "*"' >> Cargo.toml`
    +//! * Add the following to your `src/main.rs`
    +//! 
    +//! ```rust
    +//! extern crate clap;
    +//! use clap::App;
    +//! 
    +//! fn main() {
    +//!   let _ = App::new("fake").version("v1.0-beta").get_matches();
    +//! }
    +//! ```
    +//! * Build your program `$ cargo build --release`
    +//! * Run with help or version `$ ./target/release/fake --help` or `$ ./target/release/fake --version`
    +//! 
    +//! ## Usage
    +//! 
    +//! For full usage, add `clap` as a dependecy in your `Cargo.toml` file to use from crates.io:
     //! 
     //!  ```
     //!  [dependencies]