mirror of
https://github.com/clap-rs/clap
synced 2024-12-13 14:22:34 +00:00
chore(docs): rebuild docs with nightly
This commit is contained in:
parent
39d744cefd
commit
550a2f3a05
19 changed files with 424 additions and 250 deletions
|
@ -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)."]]});
|
||||
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. "]]});
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content mod">
|
||||
<h1 class='fqn'><span class='in-band'>Crate <a class='mod' href=''>clap</a><wbr></span><span class='out-of-band'><a href='stability.html'>[stability]</a> <span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-0' href='../src/clap/lib.rs.html#1-934'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'>Crate <a class='mod' href=''>clap</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-0' class='srclink' href='../src/clap/lib.rs.html#1-972' title='goto source code'>[src]</a></span></h1>
|
||||
<div class='docblock'>
|
||||
<h1 id="clap" class='section-header'><a
|
||||
href="#clap">clap</a></h1>
|
||||
|
@ -51,15 +51,15 @@
|
|||
|
||||
<p>Command Line Argument Parser for Rust</p>
|
||||
|
||||
<p>It is a simple to use and efficient library for parsing command line arguments and subcommands when writing console, or terminal applications.</p>
|
||||
<p>It is a simple to use, efficient, and full featured library for parsing command line arguments and subcommands when writing console, or terminal applications.</p>
|
||||
|
||||
<h2 id="about" class='section-header'><a
|
||||
href="#about">About</a></h2>
|
||||
<p><code>clap</code> is used to parse <em>and validate</em> the string of command line arguments provided by the user at runtime. You simply provide the list of valid possibilities, and <code>clap</code> handles the rest. This means you focus on your <em>applications</em> functionality, and less on the parsing and validating of arguments.</p>
|
||||
<p><code>clap</code> is used to parse <em>and validate</em> the string of command line arguments provided by the user at runtime. You provide the list of valid possibilities, and <code>clap</code> handles the rest. This means you focus on your <em>applications</em> functionality, and less on the parsing and validating of arguments.</p>
|
||||
|
||||
<p><code>clap</code> 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), <code>clap</code> will auto-generate the applicable ones (as well as a "help" subcommand so long as other subcommands have been manually defined as well).</p>
|
||||
<p><code>clap</code> 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), <code>clap</code> will auto-generate the applicable ones. If you are using subcommands, <code>clap</code> will also auto-generate a <code>help</code> subcommand for you in addition to the traditional flags.</p>
|
||||
|
||||
<p>After <code>clap</code> finishes parsing the user provided string, it returns all the matches along with any applicable values. If the user made an error or typo, <code>clap</code> 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.</p>
|
||||
<p>Once <code>clap</code> parses the user provided string of arguments, it returns the matches along with any applicable values. If the user made an error or typo, <code>clap</code> 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.</p>
|
||||
|
||||
<h2 id="features" class='section-header'><a
|
||||
href="#features">Features</a></h2>
|
||||
|
@ -76,7 +76,7 @@
|
|||
<ul>
|
||||
<li>Both short and long versions supported (i.e. <code>-f</code> and <code>--flag</code> respectively)</li>
|
||||
<li>Supports combining short versions (i.e. <code>-fBgoZ</code> is the same as <code>-f -B -g -o -Z</code>)</li>
|
||||
<li>Optionally supports multiple occurrences (i.e. <code>myprog -vvv</code> or <code>myprog -v -v -v</code>)</li>
|
||||
<li>Optionally supports multiple occurrences (i.e. <code>-vvv</code> or <code>-v -v -v</code>)</li>
|
||||
</ul></li>
|
||||
<li><strong>Positional Arguments</strong> (i.e. those which are based off an index from the program name)
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
|||
|
||||
<ul>
|
||||
<li>Both short and long versions supported (i.e. <code>-o value</code> and <code>--option value</code> or <code>--option=value</code> respectively)</li>
|
||||
<li>Optionally supports multiple values (i.e. <code>myprog -o <value> -o <other_value></code>)</li>
|
||||
<li>Optionally supports multiple values (i.e. <code>-o <value> -o <other_value></code>)</li>
|
||||
<li>Optionally supports Specific Value Sets (See below)</li>
|
||||
</ul></li>
|
||||
<li><strong>Sub-Commands</strong> (i.e. <code>git add <file></code> where <code>add</code> is a sub-command of <code>git</code>)
|
||||
|
@ -105,12 +105,17 @@
|
|||
<li>Required only if certain arguments are present</li>
|
||||
<li>Can require other arguments to be present</li>
|
||||
</ul></li>
|
||||
<li><strong>Exclusion Rules</strong>: Arguments can optionally define the following types of exclusion rules
|
||||
<li><strong>Exclusion/Confliction Rules</strong>: Arguments can optionally define the following types of exclusion rules
|
||||
|
||||
<ul>
|
||||
<li>Can be disallowed when certain arguments are present</li>
|
||||
<li>Can disallow use of other arguments when present</li>
|
||||
</ul></li>
|
||||
<li><strong>Groups</strong>: Arguments can optionally be made part of a group which means one, and only one argument from this "group" may be present at runtime
|
||||
|
||||
<ul>
|
||||
<li>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</li>
|
||||
</ul></li>
|
||||
<li><strong>Specific Value Sets</strong>: Positional or Option Arguments can optionally define a specific set of allowed values (i.e. imagine a <code>--mode</code> option which may <em>only</em> have one of two values <code>fast</code> or <code>slow</code> such as <code>--mode fast</code> or <code>--mode slow</code>)</li>
|
||||
<li><strong>Default Values</strong>: Although not specifically provided by <code>clap</code> you can achieve this exact functionality from Rust's <code>Option<&str>.unwrap_or("some default")</code> method (or <code>Result<T,String>.unwrap_or(T)</code> when using typed values)</li>
|
||||
<li><strong>Automatic Version from Cargo.toml</strong>: <code>clap</code> is fully compatible with Rust's <code>env!()</code> macro for automatically setting the version of your application to the version in your Cargo.toml. See <code>examples/09_AutoVersion.rs</code> for how to do this (Thanks to <a href="https://github.com/jhelwig">jhelwig</a> for pointing this out)</li>
|
||||
|
@ -119,11 +124,14 @@
|
|||
|
||||
<h2 id="quick-example" class='section-header'><a
|
||||
href="#quick-example">Quick Example</a></h2>
|
||||
<p>The following two examples show a quick example of some of the very basic functionality of <code>clap</code>. For more advanced usage, such as requirements, exclusions, multiple values and occurrences see the <a href="https://www.youtube.com/playlist?list=PLza5oFLQGTl0Bc_EU_pBNcX-rhVqDTRxv">video tutorials</a>, <a href="http://kbknapp.github.io/clap-rs/docs/clap/index.html">documentation</a>, or <code>examples/</code> directory of this repository.</p>
|
||||
<p>The following two examples show a quick example of some of the very basic functionality of <code>clap</code>. For more advanced usage, such as requirements, exclusions, groups, multiple values and occurrences see the <a href="https://www.youtube.com/playlist?list=PLza5oFLQGTl0Bc_EU_pBNcX-rhVqDTRxv">video tutorials</a>, <a href="http://kbknapp.github.io/clap-rs/docs/clap/index.html">documentation</a>, or <code>examples/</code> directory of this repository.</p>
|
||||
|
||||
<p><em>NOTE:</em> Both examples are functionally the same, but show two different ways to use <code>clap</code></p>
|
||||
<p><em>NOTE:</em> Both examples are functionally the same, but show two different styles in which to use <code>clap</code></p>
|
||||
<pre id='rust-example-rendered' class='rust '>
|
||||
<span class='comment'>// (Full example with detailed comments in examples/01a_QuickExample.rs)</span>
|
||||
<span class='comment'>//</span>
|
||||
<span class='comment'>// This example demonstrates clap's "usage strings" method of creating arguments which is less</span>
|
||||
<span class='comment'>// less verbose</span>
|
||||
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>clap</span>;
|
||||
<span class='kw'>use</span> <span class='ident'>clap</span>::{<span class='ident'>Arg</span>, <span class='ident'>App</span>, <span class='ident'>SubCommand</span>};
|
||||
|
||||
|
@ -177,6 +185,10 @@
|
|||
<p>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).</p>
|
||||
<pre id='rust-example-rendered' class='rust '>
|
||||
<span class='comment'>// (Full example with detailed comments in examples/01b_QuickExample.rs)</span>
|
||||
<span class='comment'>//</span>
|
||||
<span class='comment'>// This example demonstrates clap's full 'builder pattern' style of creating arguments which is </span>
|
||||
<span class='comment'>// more verbose, but allows easier editting, and at times more advanced options, or the possibility</span>
|
||||
<span class='comment'>// to generate arguments dynamically.</span>
|
||||
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>clap</span>;
|
||||
<span class='kw'>use</span> <span class='ident'>clap</span>::{<span class='ident'>Arg</span>, <span class='ident'>App</span>, <span class='ident'>SubCommand</span>};
|
||||
|
||||
|
@ -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:
|
|||
|
||||
<p><em>NOTE:</em> You could also run <code>myapp test --help</code> to see similar output and options for the <code>test</code> subcommand.</p>
|
||||
|
||||
<h2 id="installation" class='section-header'><a
|
||||
href="#installation">Installation</a></h2>
|
||||
<p>Add <code>clap</code> as a dependecy in your <code>Cargo.toml</code> file to use from crates.io:</p>
|
||||
<h2 id="try-it!" class='section-header'><a
|
||||
href="#try-it!">Try it!</a></h2>
|
||||
<h3 id="pre-built-test" class='section-header'><a
|
||||
href="#pre-built-test">Pre-Built Test</a></h3>
|
||||
<p>To try out the pre-built example use the following stes:</p>
|
||||
|
||||
<ul>
|
||||
<li>Clone the repostiory <code>$ git clone https://github.com/kbknapp/clap-rs && cd clap-rs/clap-tests</code></li>
|
||||
<li>Compile the example <code>$ cargo build --release</code></li>
|
||||
<li>Run the help info <code>$ ./target/release/claptests --help</code></li>
|
||||
<li>Play with the arguments!</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="byob-(build-your-own-binary)" class='section-header'><a
|
||||
href="#byob-(build-your-own-binary)">BYOB (Build Your Own Binary)</a></h3>
|
||||
<p>To test out <code>clap</code>'s default auto-generated help/version follow these steps
|
||||
* Create a new cargo project <code>$ cargo new fake --bin && cd fake</code>
|
||||
* Add <code>clap</code> to your <code>Cargo.toml</code> <code>$ echo '[dependencies]\nclap = "*"' >> Cargo.toml</code>
|
||||
* Add the following to your <code>src/main.rs</code></p>
|
||||
<pre id='rust-example-rendered' class='rust '>
|
||||
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>clap</span>;
|
||||
<span class='kw'>use</span> <span class='ident'>clap</span>::<span class='ident'>App</span>;
|
||||
|
||||
<span class='kw'>fn</span> <span class='ident'>main</span>() {
|
||||
<span class='kw'>let</span> _ <span class='op'>=</span> <span class='ident'>App</span>::<span class='ident'>new</span>(<span class='string'>"fake"</span>).<span class='ident'>version</span>(<span class='string'>"v1.0-beta"</span>).<span class='ident'>get_matches</span>();
|
||||
}
|
||||
</pre>
|
||||
|
||||
<ul>
|
||||
<li>Build your program <code>$ cargo build --release</code></li>
|
||||
<li>Run with help or version <code>$ ./target/release/fake --help</code> or <code>$ ./target/release/fake --version</code></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="usage" class='section-header'><a
|
||||
href="#usage">Usage</a></h2>
|
||||
<p>For full usage, add <code>clap</code> as a dependecy in your <code>Cargo.toml</code> file to use from crates.io:</p>
|
||||
<pre id='rust-example-rendered' class='rust '>
|
||||
[<span class='ident'>dependencies</span>]
|
||||
<span class='ident'>clap</span> <span class='op'>=</span> <span class='string'>"*"</span>
|
||||
|
@ -363,89 +408,108 @@ SUBCOMMANDS:
|
|||
<p><code>clap</code> is licensed under the MIT license. Please the LICENSE-MIT file in this repository for more information.</p>
|
||||
</div><h2 id='macros' class='section-header'><a href="#macros">Macros</a></h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='macro' href='macro.arg_enum!.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='macro' href='macro.arg_enum!.html'
|
||||
title='clap::arg_enum!'>arg_enum!</a></td>
|
||||
<td class='docblock short'><p>Convenience macro to generate more complete enums with variants to be used as a type when parsing
|
||||
<td class='docblock short'>
|
||||
<p>Convenience macro to generate more complete enums with variants to be used as a type when parsing
|
||||
arguments.</p>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='macro' href='macro.crate_version!.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='macro' href='macro.crate_version!.html'
|
||||
title='clap::crate_version!'>crate_version!</a></td>
|
||||
<td class='docblock short'><p>Allows you pull the version for an from your Cargo.toml as MAJOR.MINOR.PATCH_PKGVERSION_PRE</p>
|
||||
</td>
|
||||
<td class='docblock short'>
|
||||
<p>Allows you pull the version for an from your Cargo.toml as MAJOR.MINOR.PATCH_PKGVERSION_PRE</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='macro' href='macro.simple_enum!.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='macro' href='macro.simple_enum!.html'
|
||||
title='clap::simple_enum!'>simple_enum!</a></td>
|
||||
<td class='docblock short'><p>Convenience macro generated a simple enum with variants to be used as a type when parsing
|
||||
<td class='docblock short'>
|
||||
<p>Convenience macro generated a simple enum with variants to be used as a type when parsing
|
||||
arguments.</p>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='macro' href='macro.value_t!.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='macro' href='macro.value_t!.html'
|
||||
title='clap::value_t!'>value_t!</a></td>
|
||||
<td class='docblock short'><p>Convenience macro getting a typed value <code>T</code> where <code>T</code> implements <code>std::str::FromStr</code>
|
||||
<td class='docblock short'>
|
||||
<p>Convenience macro getting a typed value <code>T</code> where <code>T</code> implements <code>std::str::FromStr</code>
|
||||
This macro returns a <code>Result<T,String></code> 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). </p>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='macro' href='macro.value_t_or_exit!.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='macro' href='macro.value_t_or_exit!.html'
|
||||
title='clap::value_t_or_exit!'>value_t_or_exit!</a></td>
|
||||
<td class='docblock short'><p>Convenience macro getting a typed value <code>T</code> where <code>T</code> implements <code>std::str::FromStr</code>
|
||||
<td class='docblock short'>
|
||||
<p>Convenience macro getting a typed value <code>T</code> where <code>T</code> implements <code>std::str::FromStr</code>
|
||||
This macro returns a <code>T</code> or <code>Vec<T></code> or exits with a usage string upon failure. This
|
||||
removes some of the boiler plate to handle failures from value_t! above. </p>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='struct' href='struct.App.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='struct' href='struct.App.html'
|
||||
title='clap::App'>App</a></td>
|
||||
<td class='docblock short'><p>Used to create a representation of a command line program and all possible command line
|
||||
<td class='docblock short'>
|
||||
<p>Used to create a representation of a command line program and all possible command line
|
||||
arguments for parsing at runtime.</p>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='struct' href='struct.Arg.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='struct' href='struct.Arg.html'
|
||||
title='clap::Arg'>Arg</a></td>
|
||||
<td class='docblock short'><p>The abstract representation of a command line argument used by the consumer of the library.
|
||||
<td class='docblock short'>
|
||||
<p>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.</p>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='struct' href='struct.ArgGroup.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='struct' href='struct.ArgGroup.html'
|
||||
title='clap::ArgGroup'>ArgGroup</a></td>
|
||||
<td class='docblock short'><p>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 <em>only</em> one) argument
|
||||
from that group must be present. Using more than one argument from an ArgGroup causes a
|
||||
failure (graceful exit).</p>
|
||||
</td>
|
||||
<td class='docblock short'>
|
||||
<p><code>ArgGroup</code>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. </p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='struct' href='struct.ArgMatches.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='struct' href='struct.ArgMatches.html'
|
||||
title='clap::ArgMatches'>ArgMatches</a></td>
|
||||
<td class='docblock short'><p>Used to get information about the arguments that where supplied to the program at runtime by
|
||||
<td class='docblock short'>
|
||||
<p>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 <code>.get_matches()</code> of the <code>App</code> struct.</p>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='struct' href='struct.SubCommand.html'
|
||||
<tr class=' module-item'>
|
||||
<td><a class='struct' href='struct.SubCommand.html'
|
||||
title='clap::SubCommand'>SubCommand</a></td>
|
||||
<td class='docblock short'><p>The abstract representation of a command line subcommand used by the consumer of the library.</p>
|
||||
</td>
|
||||
<td class='docblock short'>
|
||||
<p>The abstract representation of a command line subcommand used by the consumer of the library.</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content macro">
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>arg_enum!</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-13314' href='../src/clap/macros.rs.html#352-439'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>arg_enum!</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-13314' class='srclink' href='../src/clap/macros.rs.html#352-439' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust macro'>
|
||||
<span class='macro'>macro_rules</span><span class='macro'>!</span> <span class='ident'>arg_enum</span> {
|
||||
(<span class='kw'>enum</span> <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>e</span>:<span class='ident'>ident</span> { $(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>v</span>:<span class='ident'>ident</span>),<span class='op'>+</span> } ) <span class='op'>=></span> {
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content macro">
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>crate_version!</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-13315' href='../src/clap/macros.rs.html#455-463'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>crate_version!</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-13315' class='srclink' href='../src/clap/macros.rs.html#455-463' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust macro'>
|
||||
<span class='macro'>macro_rules</span><span class='macro'>!</span> <span class='ident'>crate_version</span> {
|
||||
() <span class='op'>=></span> {
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content macro">
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>simple_enum!</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-13313' href='../src/clap/macros.rs.html#296-318'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>simple_enum!</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-13313' class='srclink' href='../src/clap/macros.rs.html#296-318' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust macro'>
|
||||
<span class='macro'>macro_rules</span><span class='macro'>!</span> <span class='ident'>simple_enum</span> {
|
||||
(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>e</span>:<span class='ident'>ident</span> <span class='op'>=></span> $(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>v</span>:<span class='ident'>ident</span>),<span class='op'>+</span>) <span class='op'>=></span> {
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content macro">
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>value_t!</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-13311' href='../src/clap/macros.rs.html#139-173'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>value_t!</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-13311' class='srclink' href='../src/clap/macros.rs.html#139-173' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust macro'>
|
||||
<span class='macro'>macro_rules</span><span class='macro'>!</span> <span class='ident'>value_t</span> {
|
||||
(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>m</span>:<span class='ident'>ident</span>.<span class='ident'>value_of</span>(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>v</span>:<span class='ident'>expr</span>), <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>t</span>:<span class='ident'>ty</span>) <span class='op'>=></span> {
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content macro">
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>value_t_or_exit!</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-13312' href='../src/clap/macros.rs.html#221-271'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'><a href='index.html'>clap</a>::<wbr><a class='macro' href=''>value_t_or_exit!</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-13312' class='srclink' href='../src/clap/macros.rs.html#221-271' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust macro'>
|
||||
<span class='macro'>macro_rules</span><span class='macro'>!</span> <span class='ident'>value_t_or_exit</span> {
|
||||
(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>m</span>:<span class='ident'>ident</span>.<span class='ident'>value_of</span>(<span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>v</span>:<span class='ident'>expr</span>), <span class='macro-nonterminal'>$</span><span class='macro-nonterminal'>t</span>:<span class='ident'>ty</span>) <span class='op'>=></span> {
|
||||
|
|
|
@ -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<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` 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. "]]});
|
||||
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<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` 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. "]],"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."]]});
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content struct">
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>App</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-34' href='../src/clap/app.rs.html#43-77'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>App</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-34' class='srclink' href='../src/clap/app.rs.html#43-77' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct App<'a, 'v, 'ab, 'u, 'h, 'ar> {
|
||||
// some fields omitted
|
||||
}</pre><div class='docblock'><p>Used to create a representation of a command line program and all possible command line
|
||||
|
@ -70,7 +70,7 @@ long as <code>.get_matches()</code> is last).</p>
|
|||
|
||||
<span class='comment'>// Your pogram logic starts here...</span>
|
||||
</pre>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl<'a, 'v, 'ab, 'u, 'h, 'ar> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h3><div class='impl-items'><h4 id='method.new' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.new' class='fnname'>new</a>(n: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl<'a, 'v, 'ab, 'u, 'h, 'ar> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h3><div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a>(n: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>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).</p>
|
||||
|
@ -79,7 +79,7 @@ information. The name should not contain spaces (hyphens '-' are ok).</p
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
<span class='kw'>let</span> <span class='ident'>prog</span> <span class='op'>=</span> <span class='ident'>App</span>::<span class='ident'>new</span>(<span class='string'>"myprog"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.author' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.author' class='fnname'>author</a>(self, a: &'a <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.author' class='method'><code>fn <a href='#method.author' class='fnname'>author</a>(self, a: &'a <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>Sets a string of author(s) and will be displayed to the user when they request the version
|
||||
or help information.</p>
|
||||
|
||||
|
@ -87,7 +87,7 @@ or help information.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>author</span>(<span class='string'>"Kevin <kbknapp@gmail.com>"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.about' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.about' class='fnname'>about</a>(self, a: &'ab <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.about' class='method'><code>fn <a href='#method.about' class='fnname'>about</a>(self, a: &'ab <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>Sets a string briefly describing what the program does and will be displayed when
|
||||
displaying help information.</p>
|
||||
|
||||
|
@ -95,7 +95,7 @@ displaying help information.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>about</span>(<span class='string'>"Does really amazing things to great people"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.after_help' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.after_help' class='fnname'>after_help</a>(self, h: &'h <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.after_help' class='method'><code>fn <a href='#method.after_help' class='fnname'>after_help</a>(self, h: &'h <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>Adds additional help information to be displayed in addition to and directly after
|
||||
auto-generated help. This information is displayed <strong>after</strong> 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.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>after_help</span>(<span class='string'>"Does really amazing things to great people"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.version' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.version' class='fnname'>version</a>(self, v: &'v <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.version' class='method'><code>fn <a href='#method.version' class='fnname'>version</a>(self, v: &'v <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>Sets a string of the version number to be displayed when displaying version or help
|
||||
information.</p>
|
||||
|
||||
|
@ -113,7 +113,7 @@ information.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>version</span>(<span class='string'>"v0.1.24"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.usage' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.usage' class='fnname'>usage</a>(self, u: &'u <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.usage' class='method'><code>fn <a href='#method.usage' class='fnname'>usage</a>(self, u: &'u <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>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
|
||||
<code>ArgMatches::usage()</code></p>
|
||||
|
@ -129,7 +129,7 @@ showing the usage.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>usage</span>(<span class='string'>"myapp [-clDas] <some_file>"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.arg' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.arg' class='fnname'>arg</a>(self, a: <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'ar, 'ar, 'ar, 'ar, 'ar, 'ar>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.arg' class='method'><code>fn <a href='#method.arg' class='fnname'>arg</a>(self, a: <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'ar, 'ar, 'ar, 'ar, 'ar, 'ar>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
|||
<span class='comment'>// Adding a single "option" argument with a short, a long, and help text using the less verbose Arg::from_usage()</span>
|
||||
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"-c --config=[CONFIG] 'Optionally sets a configuration file to use'"</span>))
|
||||
</pre>
|
||||
</div><h4 id='method.args' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.args' class='fnname'>args</a>(self, args: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'ar, 'ar, 'ar, 'ar, 'ar, 'ar>>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.args' class='method'><code>fn <a href='#method.args' class='fnname'>args</a>(self, args: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'ar, 'ar, 'ar, 'ar, 'ar, 'ar>>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>Adds multiple arguments to the list of valid possibilties by iterating over a Vec of Args</p>
|
||||
|
||||
<h1 id="example" class='section-header'><a
|
||||
|
@ -156,7 +156,7 @@ control over the advanced configuration options.</p>
|
|||
.<span class='ident'>args</span>( <span class='macro'>vec</span><span class='macro'>!</span>[<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"[debug] -d 'turns on debugging info"</span>),
|
||||
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>"input"</span>).<span class='ident'>index</span>(<span class='number'>1</span>).<span class='ident'>help</span>(<span class='string'>"the input file to use"</span>)])
|
||||
</pre>
|
||||
</div><h4 id='method.arg_from_usage' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.arg_from_usage' class='fnname'>arg_from_usage</a>(self, usage: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.arg_from_usage' class='method'><code>fn <a href='#method.arg_from_usage' class='fnname'>arg_from_usage</a>(self, usage: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>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 <code>Arg::from_usage()</code></p>
|
||||
|
||||
|
@ -167,7 +167,7 @@ from a usage type string. The string used follows the same rules and syntax as <
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>arg_from_usage</span>(<span class='string'>"-c --conf=<config> 'Sets a configuration file to use'"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.args_from_usage' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.args_from_usage' class='fnname'>args_from_usage</a>(self, usage: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.args_from_usage' class='method'><code>fn <a href='#method.args_from_usage' class='fnname'>args_from_usage</a>(self, usage: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>Adds multiple arguments at once from a usage string, one per line. See <code>Arg::from_usage()</code>
|
||||
for details on the syntax and rules supported.</p>
|
||||
|
||||
|
@ -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'"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.arg_group' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.arg_group' class='fnname'>arg_group</a>(self, group: <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'ar, 'ar>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.arg_group' class='method'><code>fn <a href='#method.arg_group' class='fnname'>arg_group</a>(self, group: <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'ar, 'ar>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>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 <em>only</em> one) argument
|
||||
|
@ -211,7 +211,7 @@ group</p>
|
|||
.<span class='ident'>add_all</span>(<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"ver"</span>, <span class='string'>"major"</span>, <span class='string'>"minor"</span>,<span class='string'>"patch"</span>])
|
||||
.<span class='ident'>required</span>(<span class='boolval'>true</span>))
|
||||
</pre>
|
||||
</div><h4 id='method.arg_groups' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.arg_groups' class='fnname'>arg_groups</a>(self, groups: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'ar, 'ar>>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.arg_groups' class='method'><code>fn <a href='#method.arg_groups' class='fnname'>arg_groups</a>(self, groups: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'ar, 'ar>>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>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 <em>only</em> one) argument
|
||||
|
@ -240,7 +240,7 @@ group</p>
|
|||
.<span class='ident'>add_all</span>(<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"ver"</span>, <span class='string'>"major"</span>, <span class='string'>"minor"</span>,<span class='string'>"patch"</span>])
|
||||
.<span class='ident'>required</span>(<span class='boolval'>true</span>))
|
||||
</pre>
|
||||
</div><h4 id='method.subcommand' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.subcommand' class='fnname'>subcommand</a>(self, subcmd: <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.subcommand' class='method'><code>fn <a href='#method.subcommand' class='fnname'>subcommand</a>(self, subcmd: <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
|
@ -252,7 +252,7 @@ function just like apps, in that they get their own auto generated help, version
|
|||
.<span class='ident'>arg_from_usage</span>(<span class='string'>"<config> 'Required configuration file to use'"</span>))
|
||||
<span class='comment'>// Additional subcommand configuration goes here, such as other arguments...</span>
|
||||
</pre>
|
||||
</div><h4 id='method.subcommands' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.subcommands' class='fnname'>subcommands</a>(self, subcmds: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar>>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
</div><h4 id='method.subcommands' class='method'><code>fn <a href='#method.subcommands' class='fnname'>subcommands</a>(self, subcmds: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar>>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>Adds multiple subcommands to the list of valid possibilties by iterating over a Vec of <code>SubCommand</code>s</p>
|
||||
|
||||
<h1 id="example" class='section-header'><a
|
||||
|
@ -262,7 +262,7 @@ function just like apps, in that they get their own auto generated help, version
|
|||
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>"config_file"</span>).<span class='ident'>index</span>(<span class='number'>1</span>)),
|
||||
<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>"debug"</span>).<span class='ident'>about</span>(<span class='string'>"Controls debug functionality"</span>)])
|
||||
</pre>
|
||||
</div><h4 id='method.get_matches' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.get_matches' class='fnname'>get_matches</a>(self) -> <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a><'ar, 'ar></code></h4>
|
||||
</div><h4 id='method.get_matches' class='method'><code>fn <a href='#method.get_matches' class='fnname'>get_matches</a>(self) -> <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a><'ar, 'ar></code></h4>
|
||||
</div></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content struct">
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>Arg</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-10470' href='../src/clap/args/arg.rs.html#31-79'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>Arg</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-10470' class='srclink' href='../src/clap/args/arg.rs.html#31-79' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct Arg<'n, 'l, 'h, 'g, 'p, 'r> {
|
||||
// some fields omitted
|
||||
}</pre><div class='docblock'><p>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.</p>
|
|||
<span class='comment'>// Using a usage string (setting a similar argument to the one above)</span>
|
||||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"-i --input=[input] 'Provides an input file to the program'"</span>)
|
||||
</pre>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl<'n, 'l, 'h, 'g, 'p, 'r> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h3><div class='impl-items'><h4 id='method.new' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.new' class='fnname'>new</a>(n: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl<'n, 'l, 'h, 'g, 'p, 'r> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h3><div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a>(n: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Creates a new instace of <code>Arg</code> 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. </p>
|
||||
|
@ -84,7 +84,7 @@ Rust APIs</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>"conifg"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.with_name' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.with_name' class='fnname'>with_name</a>(n: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.with_name' class='method'><code>fn <a href='#method.with_name' class='fnname'>with_name</a>(n: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Creates a new instace of <code>Arg</code> 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. </p>
|
||||
|
@ -97,7 +97,7 @@ be displayed when the user prints the usage/help information of the program.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>"conifg"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.from_usage' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.from_usage' class='fnname'>from_usage</a>(u: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'n, 'n, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.from_usage' class='method'><code>fn <a href='#method.from_usage' class='fnname'>from_usage</a>(u: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'n, 'n, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Creates a new instace of <code>Arg</code> 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.</p>
|
||||
|
@ -144,7 +144,7 @@ specify one) i.e. all arguments without a <code>short</code> or <code>long</code
|
|||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"<input> 'the input file to use'"</span>)
|
||||
])
|
||||
</pre>
|
||||
</div><h4 id='method.short' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.short' class='fnname'>short</a>(self, s: &<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.short' class='method'><code>fn <a href='#method.short' class='fnname'>short</a>(self, s: &<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets the short version of the argument without the preceding <code>-</code>.</p>
|
||||
|
||||
<p>By default <code>clap</code> automatically assigns <code>v</code> and <code>h</code> to display version and help information
|
||||
|
@ -158,7 +158,7 @@ non <code>-</code> chacter will be used as the <code>short</code> version</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>short</span>(<span class='string'>"c"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.long' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.long' class='fnname'>long</a>(self, l: &'l <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.long' class='method'><code>fn <a href='#method.long' class='fnname'>long</a>(self, l: &'l <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets the long version of the argument without the preceding <code>--</code>.</p>
|
||||
|
||||
<p>By default <code>clap</code> automatically assigns <code>version</code> and <code>help</code> to display version and help information
|
||||
|
@ -172,7 +172,7 @@ so manually.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>long</span>(<span class='string'>"config"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.help' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.help' class='fnname'>help</a>(self, h: &'h <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.help' class='method'><code>fn <a href='#method.help' class='fnname'>help</a>(self, h: &'h <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets the help text of the argument that will be displayed to the user
|
||||
when they print the usage/help information. </p>
|
||||
|
||||
|
@ -180,7 +180,7 @@ when they print the usage/help information. </p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>help</span>(<span class='string'>"The config file used by the myprog"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.required' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.required' class='fnname'>required</a>(self, r: <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.required' class='method'><code>fn <a href='#method.required' class='fnname'>required</a>(self, r: <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>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. </p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>required</span>(<span class='boolval'>true</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.mutually_excludes' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.mutually_excludes' class='fnname'>mutually_excludes</a>(self, name: &'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.mutually_excludes' class='method'><code>fn <a href='#method.mutually_excludes' class='fnname'>mutually_excludes</a>(self, name: &'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets a mutually exclusive argument by name. I.e. when using this argument,
|
||||
the following argument can't be present.</p>
|
||||
|
||||
|
@ -208,7 +208,7 @@ arguments, they do not need to be set for each.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>mutually_excludes</span>(<span class='string'>"debug"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.mutually_excludes_all' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.mutually_excludes_all' class='fnname'>mutually_excludes_all</a>(self, names: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.mutually_excludes_all' class='method'><code>fn <a href='#method.mutually_excludes_all' class='fnname'>mutually_excludes_all</a>(self, names: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets a mutually exclusive arguments by names. I.e. when using this argument,
|
||||
the following argument can't be present.</p>
|
||||
|
||||
|
@ -223,7 +223,7 @@ arguments, they do not need to be set for each.</p>
|
|||
.<span class='ident'>mutually_excludes_all</span>(
|
||||
<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"debug"</span>, <span class='string'>"input"</span>])
|
||||
</pre>
|
||||
</div><h4 id='method.conflicts_with' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.conflicts_with' class='fnname'>conflicts_with</a>(self, name: &'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.conflicts_with' class='method'><code>fn <a href='#method.conflicts_with' class='fnname'>conflicts_with</a>(self, name: &'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets a mutually exclusive argument by name. I.e. when using this argument,
|
||||
the following argument can't be present.</p>
|
||||
|
||||
|
@ -235,7 +235,7 @@ arguments, they do not need to be set for each.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>conflicts_with</span>(<span class='string'>"debug"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.conflicts_with_all' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.conflicts_with_all' class='fnname'>conflicts_with_all</a>(self, names: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.conflicts_with_all' class='method'><code>fn <a href='#method.conflicts_with_all' class='fnname'>conflicts_with_all</a>(self, names: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets mutually exclusive arguments by names. I.e. when using this argument,
|
||||
the following argument can't be present.</p>
|
||||
|
||||
|
@ -248,7 +248,7 @@ arguments, they do not need to be set for each.</p>
|
|||
.<span class='ident'>conflicts_with_all</span>(
|
||||
<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"debug"</span>, <span class='string'>"input"</span>])
|
||||
</pre>
|
||||
</div><h4 id='method.requires' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.requires' class='fnname'>requires</a>(self, name: &'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.requires' class='method'><code>fn <a href='#method.requires' class='fnname'>requires</a>(self, name: &'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets an argument by name that is required when this one is presnet I.e. when
|
||||
using this argument, the following argument <em>must</em> be present.</p>
|
||||
|
||||
|
@ -258,7 +258,7 @@ using this argument, the following argument <em>must</em> be present.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>requires</span>(<span class='string'>"debug"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.requires_all' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.requires_all' class='fnname'>requires_all</a>(self, names: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.requires_all' class='method'><code>fn <a href='#method.requires_all' class='fnname'>requires_all</a>(self, names: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Sets arguments by names that are required when this one is presnet I.e. when
|
||||
using this argument, the following arguments <em>must</em> be present.</p>
|
||||
|
||||
|
@ -270,7 +270,7 @@ by default. </p>
|
|||
.<span class='ident'>requires_all</span>(
|
||||
<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"debug"</span>, <span class='string'>"input"</span>])
|
||||
</pre>
|
||||
</div><h4 id='method.takes_value' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.takes_value' class='fnname'>takes_value</a>(self, tv: <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.takes_value' class='method'><code>fn <a href='#method.takes_value' class='fnname'>takes_value</a>(self, tv: <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Specifies that the argument takes an additional value at run time.</p>
|
||||
|
||||
<p><strong>NOTE:</strong> When setting this to <code>true</code> the <code>name</code> of the argument
|
||||
|
@ -280,7 +280,7 @@ will be used when printing the help/usage information to the user. </p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.index' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.index' class='fnname'>index</a>(self, idx: <a href='http://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.index' class='method'><code>fn <a href='#method.index' class='fnname'>index</a>(self, idx: <a href='http://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Specifies the index of a positional argument starting at 1.</p>
|
||||
|
||||
<p><strong>NOTE:</strong> When setting this, any <code>short</code> or <code>long</code> values you set
|
||||
|
@ -292,7 +292,7 @@ to the user. </p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>index</span>(<span class='number'>1</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.multiple' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.multiple' class='fnname'>multiple</a>(self, multi: <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.multiple' class='method'><code>fn <a href='#method.multiple' class='fnname'>multiple</a>(self, multi: <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Specifies if the flag may appear more than once such as for multiple debugging
|
||||
levels (as an example). <code>-ddd</code> for three levels of debugging, or <code>-d -d -d</code>.
|
||||
When this is set to <code>true</code> you recieve the number of occurances the user supplied
|
||||
|
@ -305,7 +305,7 @@ are ignored as flags cannot have a values or an <code>index</code>.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>multiple</span>(<span class='boolval'>true</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.possible_values' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.possible_values' class='fnname'>possible_values</a>(self, names: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'p <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.possible_values' class='method'><code>fn <a href='#method.possible_values' class='fnname'>possible_values</a>(self, names: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'p <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
|
||||
|
@ -315,7 +315,7 @@ one of the specified values was used, or fails with a usage string.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>possible_values</span>(<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"fast"</span>, <span class='string'>"slow"</span>])
|
||||
</pre>
|
||||
</div><h4 id='method.group' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.group' class='fnname'>group</a>(self, name: &'g <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
</div><h4 id='method.group' class='method'><code>fn <a href='#method.group' class='fnname'>group</a>(self, name: &'g <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'g, 'p, 'r></code></h4>
|
||||
<div class='docblock'><p>Specifies the name of the group the argument belongs to.</p>
|
||||
|
||||
<h1 id="example" class='section-header'><a
|
||||
|
|
|
@ -41,32 +41,37 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content struct">
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>ArgGroup</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-12397' href='../src/clap/args/group.rs.html#36-47'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>ArgGroup</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-12397' class='srclink' href='../src/clap/args/group.rs.html#41-52' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct ArgGroup<'n, 'ar> {
|
||||
// some fields omitted
|
||||
}</pre><div class='docblock'><p>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 <em>only</em> one) argument
|
||||
from that group must be present. Using more than one argument from an ArgGroup causes a
|
||||
failure (graceful exit).</p>
|
||||
}</pre><div class='docblock'><p><code>ArgGroup</code>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. </p>
|
||||
|
||||
<p>For instance, you can make an entire ArgGroup required, this means that one (and <em>only</em> one)
|
||||
argument. from that group must be present. Using more than one argument from an ArgGroup causes
|
||||
a failure (graceful exit).</p>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<p>Perhaps the most common use of ArgGroups is to require one and <em>only</em> 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 <code>--set-ver v1.2.3</code>, you also wanted to support automatically using a previous
|
||||
version numer and simply incrementing one of the three numbers, so you create three flags
|
||||
<code>--major</code>, <code>--minor</code>, and <code>--patch</code>. All of these arguments shouldn't be used at one time
|
||||
but perhaps you want to specify that <em>at least one</em> of them is used. You can create a
|
||||
group</p>
|
||||
<p>Perhaps the most common use of <code>ArgGroup</code>s is to require one and <em>only</em> 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. <code>--set-ver v1.2.3</code>, you
|
||||
also wanted to support automatically using a previous version number and simply incrementing one
|
||||
of the three numbers. So you create three flags <code>--major</code>, <code>--minor</code>, and <code>--patch</code>. All of
|
||||
these arguments shouldn't be used at one time but you want to specify that <em>at least one</em> of
|
||||
them is used. For this, you can create a group.</p>
|
||||
|
||||
<h1 id="example" class='section-header'><a
|
||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
<span class='kw'>let</span> _ <span class='op'>=</span> <span class='ident'>App</span>::<span class='ident'>new</span>(<span class='string'>"app"</span>)
|
||||
.<span class='ident'>args_from_usage</span>(<span class='string'>"--set-ver [ver] 'set the version manually'
|
||||
--major 'auto increase major'
|
||||
--minor 'auto increase minor'
|
||||
|
@ -75,7 +80,7 @@ group</p>
|
|||
.<span class='ident'>add_all</span>(<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"ver"</span>, <span class='string'>"major"</span>, <span class='string'>"minor"</span>,<span class='string'>"patch"</span>])
|
||||
.<span class='ident'>required</span>(<span class='boolval'>true</span>))
|
||||
</pre>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl<'n, 'ar> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h3><div class='impl-items'><h4 id='method.with_name' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.with_name' class='fnname'>with_name</a>(n: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl<'n, 'ar> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h3><div class='impl-items'><h4 id='method.with_name' class='method'><code>fn <a href='#method.with_name' class='fnname'>with_name</a>(n: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>Creates a new instace of <code>ArgGroup</code> using a unique string name.
|
||||
The name will only be used by the library consumer and not displayed to the user</p>
|
||||
|
||||
|
@ -83,21 +88,21 @@ The name will only be used by the library consumer and not displayed to the user
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
<span class='ident'>ArgGroup</span>::<span class='ident'>with_name</span>(<span class='string'>"conifg"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.add' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.add' class='fnname'>add</a>(self, n: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
</div><h4 id='method.add' class='method'><code>fn <a href='#method.add' class='fnname'>add</a>(self, n: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>Adds an argument to this group by name</p>
|
||||
|
||||
<h1 id="example" class='section-header'><a
|
||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>add</span>(<span class='string'>"config"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.add_all' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.add_all' class='fnname'>add_all</a>(self, ns: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>Adds multiple arguments to this group by name inside a Vec</p>
|
||||
</div><h4 id='method.add_all' class='method'><code>fn <a href='#method.add_all' class='fnname'>add_all</a>(self, ns: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>Adds multiple arguments to this group by name using a Vec</p>
|
||||
|
||||
<h1 id="example" class='section-header'><a
|
||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>add_all</span>(<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"config"</span>, <span class='string'>"input"</span>, <span class='string'>"output"</span>])
|
||||
</pre>
|
||||
</div><h4 id='method.required' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.required' class='fnname'>required</a>(self, r: <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
</div><h4 id='method.required' class='method'><code>fn <a href='#method.required' class='fnname'>required</a>(self, r: <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>Sets the requirement of this group. A required group will be displayed in the usage string
|
||||
of the application in the format <code>[arg|arg2|arg3]</code>. A required <code>ArgGroup</code> simply states
|
||||
that one, and only one argument from this group <em>must</em> be present at runtime (unless
|
||||
|
@ -107,10 +112,10 @@ conflicting with another argument).</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>required</span>(<span class='boolval'>true</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.requires' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.requires' class='fnname'>requires</a>(self, n: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
</div><h4 id='method.requires' class='method'><code>fn <a href='#method.requires' class='fnname'>requires</a>(self, n: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
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.</p>
|
||||
|
||||
<p><strong>NOTE:</strong> The name provided may be an argument, or group name</p>
|
||||
|
||||
|
@ -118,10 +123,10 @@ or groups that must be present when one of the arguments from this group is used
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>requires</span>(<span class='string'>"config"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.requires_all' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.requires_all' class='fnname'>requires_all</a>(self, ns: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
</div><h4 id='method.requires_all' class='method'><code>fn <a href='#method.requires_all' class='fnname'>requires_all</a>(self, ns: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
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.</p>
|
||||
|
||||
<p><strong>NOTE:</strong> The names provided may be an argument, or group name</p>
|
||||
|
||||
|
@ -129,10 +134,10 @@ or groups that must be present when one of the arguments from this group is used
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>requires_all</span>(<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"config"</span>, <span class='string'>"input"</span>])
|
||||
</pre>
|
||||
</div><h4 id='method.conflicts_with' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.conflicts_with' class='fnname'>conflicts_with</a>(self, n: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
</div><h4 id='method.conflicts_with' class='method'><code>fn <a href='#method.conflicts_with' class='fnname'>conflicts_with</a>(self, n: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
|
||||
<p><strong>NOTE:</strong> The name provided may be an argument, or group name</p>
|
||||
|
||||
|
@ -140,10 +145,10 @@ from this group are used.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>conflicts_with</span>(<span class='string'>"config"</span>)
|
||||
</pre>
|
||||
</div><h4 id='method.conflicts_with_all' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.conflicts_with_all' class='fnname'>conflicts_with_all</a>(self, ns: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
</div><h4 id='method.conflicts_with_all' class='method'><code>fn <a href='#method.conflicts_with_all' class='fnname'>conflicts_with_all</a>(self, ns: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>) -> <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
|
||||
<p><strong>NOTE:</strong> The names provided may be an argument, or group name</p>
|
||||
|
||||
|
@ -151,7 +156,7 @@ from this group are used.</p>
|
|||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||
.<span class='ident'>conflicts_with_all</span>(<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"config"</span>, <span class='string'>"input"</span>])
|
||||
</pre>
|
||||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><a class='stability Stable' title='Stable'></a><code>impl<'n, 'ar> <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h3><div class='impl-items'><h4 id='method.fmt' class='method'><a class='stability Stable' title='Stable'></a><code>fn <a href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#method.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class='struct' href='http://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -> <a class='type' href='http://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></h4>
|
||||
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><code>impl<'n, 'ar> <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='../clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar></code></h3><div class='impl-items'><h4 id='method.fmt' class='method'><code>fn <a href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#method.fmt' class='fnname'>fmt</a>(&self, f: &mut <a class='struct' href='http://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -> <a class='type' href='http://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></h4>
|
||||
</div></section>
|
||||
<section id='search' class="content hidden"></section>
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content struct">
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>ArgMatches</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-11482' href='../src/clap/args/argmatches.rs.html#55-62'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>ArgMatches</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-11482' class='srclink' href='../src/clap/args/argmatches.rs.html#55-62' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct ArgMatches<'n, 'a> {
|
||||
// some fields omitted
|
||||
}</pre><div class='docblock'><p>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 <code>.get_matches()</cod
|
|||
}
|
||||
}
|
||||
</pre>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl<'n, 'a> <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a><'n, 'a></code></h3><div class='impl-items'><h4 id='method.value_of' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.value_of' class='fnname'>value_of</a><'na>(&self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>></code></h4>
|
||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl<'n, 'a> <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a><'n, 'a></code></h3><div class='impl-items'><h4 id='method.value_of' class='method'><code>fn <a href='#method.value_of' class='fnname'>value_of</a><'na>(&self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>></code></h4>
|
||||
<div class='docblock'><p>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 <code>None</code>. </p>
|
||||
|
@ -100,7 +100,7 @@ prefer <code>values_of()</code> as <code>value_of()</code> will only return the
|
|||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"Value for output: {}"</span>, <span class='ident'>o</span>);
|
||||
}
|
||||
</pre>
|
||||
</div><h4 id='method.values_of' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.values_of' class='fnname'>values_of</a><'na>(&'a self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'a <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>></code></h4>
|
||||
</div><h4 id='method.values_of' class='method'><code>fn <a href='#method.values_of' class='fnname'>values_of</a><'na>(&'a self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><<a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><&'a <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>></code></h4>
|
||||
<div class='docblock'><p>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 <code>None</code></p>
|
||||
|
@ -116,7 +116,7 @@ returns <code>None</code></p>
|
|||
}
|
||||
}
|
||||
</pre>
|
||||
</div><h4 id='method.is_present' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.is_present' class='fnname'>is_present</a><'na>(&self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||||
</div><h4 id='method.is_present' class='method'><code>fn <a href='#method.is_present' class='fnname'>is_present</a><'na>(&self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
|
||||
<div class='docblock'><p>Returns if an argument was present at runtime.</p>
|
||||
|
||||
<h1 id="example" class='section-header'><a
|
||||
|
@ -125,7 +125,7 @@ returns <code>None</code></p>
|
|||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"The output argument was used!"</span>);
|
||||
}
|
||||
</pre>
|
||||
</div><h4 id='method.occurrences_of' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.occurrences_of' class='fnname'>occurrences_of</a><'na>(&self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a></code></h4>
|
||||
</div><h4 id='method.occurrences_of' class='method'><code>fn <a href='#method.occurrences_of' class='fnname'>occurrences_of</a><'na>(&self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.u8.html'>u8</a></code></h4>
|
||||
<div class='docblock'><p>Returns the number of occurrences of an option, flag, or positional argument at runtime.
|
||||
If an argument isn't present it will return <code>0</code>. Can be used on arguments which <em>don't</em>
|
||||
allow multiple occurrences, but will obviously only return <code>0</code> or <code>1</code>.</p>
|
||||
|
@ -138,7 +138,7 @@ allow multiple occurrences, but will obviously only return <code>0</code> or <co
|
|||
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>"Debug mode kind of on"</span>);
|
||||
}
|
||||
</pre>
|
||||
</div><h4 id='method.subcommand_matches' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.subcommand_matches' class='fnname'>subcommand_matches</a><'na>(&self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&<a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a>></code></h4>
|
||||
</div><h4 id='method.subcommand_matches' class='method'><code>fn <a href='#method.subcommand_matches' class='fnname'>subcommand_matches</a><'na>(&self, name: &'na <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&<a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a>></code></h4>
|
||||
<div class='docblock'><p>Returns the <code>ArgMatches</code> for a particular subcommand or None if the subcommand wasn't
|
||||
present at runtime.</p>
|
||||
|
||||
|
@ -148,7 +148,7 @@ present at runtime.</p>
|
|||
<span class='comment'>// Use matches as normal</span>
|
||||
}
|
||||
</pre>
|
||||
</div><h4 id='method.subcommand_name' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.subcommand_name' class='fnname'>subcommand_name</a>(&self) -> <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>></code></h4>
|
||||
</div><h4 id='method.subcommand_name' class='method'><code>fn <a href='#method.subcommand_name' class='fnname'>subcommand_name</a>(&self) -> <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>></code></h4>
|
||||
<div class='docblock'><p>Returns the name of the subcommand used of the parent <code>App</code>, or <code>None</code> if one wasn't found</p>
|
||||
|
||||
<p><em>NOTE</em>: Only a single subcommand may be present per <code>App</code> at runtime, does <em>NOT</em> check for
|
||||
|
@ -162,7 +162,7 @@ the name of sub-subcommand's names</p>
|
|||
_ <span class='op'>=></span> {}, <span class='comment'>// Either no subcommand or one not tested for...</span>
|
||||
}
|
||||
</pre>
|
||||
</div><h4 id='method.subcommand' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.subcommand' class='fnname'>subcommand</a>(&self) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(&<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&<a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a>>)</a></code></h4>
|
||||
</div><h4 id='method.subcommand' class='method'><code>fn <a href='#method.subcommand' class='fnname'>subcommand</a>(&self) -> <a href='http://doc.rust-lang.org/nightly/std/primitive.tuple.html'>(&<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&<a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a>>)</a></code></h4>
|
||||
<div class='docblock'><p>Returns the name and <code>ArgMatches</code> of the subcommand used at runtime or ("", None) if one
|
||||
wasn't found.</p>
|
||||
|
||||
|
@ -174,7 +174,7 @@ wasn't found.</p>
|
|||
_ <span class='op'>=></span> {}, <span class='comment'>// Either no subcommand or one not tested for...</span>
|
||||
}
|
||||
</pre>
|
||||
</div><h4 id='method.usage' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.usage' class='fnname'>usage</a>(&self) -> &<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
|
||||
</div><h4 id='method.usage' class='method'><code>fn <a href='#method.usage' class='fnname'>usage</a>(&self) -> &<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
|
||||
<div class='docblock'><p>Returns a string slice of the usage statement for the <code>App</code> (or <code>SubCommand</code>)</p>
|
||||
|
||||
<h1 id="example" class='section-header'><a
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
</nav>
|
||||
|
||||
<section id='main' class="content struct">
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>SubCommand</a><wbr></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="collapse-all" href="#">[-]</a> <a id="expand-all" href="#">[+]</a>
|
||||
</span><a id='src-11846' href='../src/clap/args/subcommand.rs.html#23-26'>[src]</a></span></h1>
|
||||
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>SubCommand</a></span><span class='out-of-band'><span id='render-detail'>
|
||||
<a id="toggle-all-docs" href="#" title="collapse all docs">[-]</a>
|
||||
</span><a id='src-11846' class='srclink' href='../src/clap/args/subcommand.rs.html#23-26' title='goto source code'>[src]</a></span></h1>
|
||||
<pre class='rust struct'>pub struct SubCommand<'n, 'a> {
|
||||
pub name: &'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>,
|
||||
pub matches: <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a><'n, 'a>,
|
||||
|
@ -62,7 +62,9 @@ their own arguments and subcommands).</p>
|
|||
.<span class='ident'>index</span>(<span class='number'>1</span>))
|
||||
</pre>
|
||||
</div><h2 class='fields'>Fields</h2>
|
||||
<table><tr><td id='structfield.name'><a class='stability Unmarked' title='No stability level'></a><code>name</code></td><td></td></tr><tr><td id='structfield.matches'><a class='stability Unmarked' title='No stability level'></a><code>matches</code></td><td></td></tr></table><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl<'n, 'a> <a class='struct' href='../clap/struct.SubCommand.html' title='clap::SubCommand'>SubCommand</a><'n, 'a></code></h3><div class='impl-items'><h4 id='method.new' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.new' class='fnname'>new</a><'au, 'v, 'ab, 'u, 'h, 'ar>(name: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'au, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<table><tr class='stab '>
|
||||
<td id='structfield.name'><code>name</code></td><td></td></tr><tr class='stab '>
|
||||
<td id='structfield.matches'><code>matches</code></td><td></td></tr></table><h2 id='methods'>Methods</h2><h3 class='impl'><code>impl<'n, 'a> <a class='struct' href='../clap/struct.SubCommand.html' title='clap::SubCommand'>SubCommand</a><'n, 'a></code></h3><div class='impl-items'><h4 id='method.new' class='method'><code>fn <a href='#method.new' class='fnname'>new</a><'au, 'v, 'ab, 'u, 'h, 'ar>(name: &'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'au, 'v, 'ab, 'u, 'h, 'ar></code></h4>
|
||||
<div class='docblock'><p>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.</p>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
(function() {var implementors = {};
|
||||
implementors['clap'] = ["<a class='stability Stable' title='Stable'></a>impl<'n, 'ar> <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar>",];
|
||||
implementors['clap'] = ["impl<'n, 'ar> <a class='trait' href='http://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='clap/struct.ArgGroup.html' title='clap::ArgGroup'>ArgGroup</a><'n, 'ar>",];
|
||||
|
||||
if (window.register_implementors) {
|
||||
window.register_implementors(implementors);
|
||||
|
|
|
@ -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 {
|
||||
|
|
42
docs/main.js
42
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("[<span class='inner'>-</span>]");
|
||||
|
||||
$(".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 =
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -280,34 +280,44 @@
|
|||
<span id="238">238</span>
|
||||
<span id="239">239</span>
|
||||
<span id="240">240</span>
|
||||
<span id="241">241</span>
|
||||
<span id="242">242</span>
|
||||
<span id="243">243</span>
|
||||
<span id="244">244</span>
|
||||
<span id="245">245</span>
|
||||
</pre><pre class='rust '>
|
||||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>collections</span>::<span class='ident'>HashSet</span>;
|
||||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>fmt</span>::{<span class='ident'>Debug</span>, <span class='ident'>Formatter</span>, <span class='prelude-ty'>Result</span>};
|
||||
|
||||
<span class='doccomment'>/// ArgGroups are a family of related arguments and provide a few useful features for you. By </span>
|
||||
<span class='doccomment'>/// placing arguments in a logical group, you can make easier requirement and exclusion rules. For </span>
|
||||
<span class='doccomment'>/// instance, you can make an ArgGroup required, this means that one (and *only* one) argument</span>
|
||||
<span class='doccomment'>/// from that group must be present. Using more than one argument from an ArgGroup causes a </span>
|
||||
<span class='doccomment'>/// failure (graceful exit).</span>
|
||||
<span class='doccomment'>/// `ArgGroup`s are a family of related arguments and way for you to say, "Any of these arguments".</span>
|
||||
<span class='doccomment'>/// By placing arguments in a logical group, you can make easier requirement and exclusion rules</span>
|
||||
<span class='doccomment'>/// intead of having to list each individually, or when you want a rule to apply "any but not all"</span>
|
||||
<span class='doccomment'>/// arguments. </span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// For instance, you can make an entire ArgGroup required, this means that one (and *only* one)</span>
|
||||
<span class='doccomment'>/// argument. from that group must be present. Using more than one argument from an ArgGroup causes</span>
|
||||
<span class='doccomment'>/// a failure (graceful exit).</span>
|
||||
<span class='doccomment'>/// </span>
|
||||
<span class='doccomment'>/// You can also do things such as name an ArgGroup as a confliction or requirement, meaning any </span>
|
||||
<span class='doccomment'>/// of the arguments that belong to that group will cause a failure if present, or must present</span>
|
||||
<span class='doccomment'>/// respectively.</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// Perhaps the most common use of ArgGroups is to require one and *only* one argument to be </span>
|
||||
<span class='doccomment'>/// present out of a given set. For example, lets say that you were building an application</span>
|
||||
<span class='doccomment'>/// where one could set a given version number by supplying a string using an option argument,</span>
|
||||
<span class='doccomment'>/// such as `--set-ver v1.2.3`, you also wanted to support automatically using a previous</span>
|
||||
<span class='doccomment'>/// version numer and simply incrementing one of the three numbers, so you create three flags</span>
|
||||
<span class='doccomment'>/// `--major`, `--minor`, and `--patch`. All of these arguments shouldn't be used at one time</span>
|
||||
<span class='doccomment'>/// but perhaps you want to specify that *at least one* of them is used. You can create a</span>
|
||||
<span class='doccomment'>/// group</span>
|
||||
<span class='doccomment'>/// Perhaps the most common use of `ArgGroup`s is to require one and *only* one argument to be </span>
|
||||
<span class='doccomment'>/// present out of a given set. Imagine that you had multiple arguments, and you want one of them to</span>
|
||||
<span class='doccomment'>/// be required, but making all of them required isn't feasible because perhaps they conflict with</span>
|
||||
<span class='doccomment'>/// each other. For example, lets say that you were building an application where one could set a</span>
|
||||
<span class='doccomment'>/// given version number by supplying a string with an option argument, i.e. `--set-ver v1.2.3`, you </span>
|
||||
<span class='doccomment'>/// also wanted to support automatically using a previous version number and simply incrementing one</span>
|
||||
<span class='doccomment'>/// of the three numbers. So you create three flags `--major`, `--minor`, and `--patch`. All of</span>
|
||||
<span class='doccomment'>/// these arguments shouldn't be used at one time but you want to specify that *at least one* of</span>
|
||||
<span class='doccomment'>/// them is used. For this, you can create a group.</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// # Example</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// ```no_run</span>
|
||||
<span class='doccomment'>/// # use clap::{App, ArgGroup};</span>
|
||||
<span class='doccomment'>/// # let _ = App::new("app")</span>
|
||||
<span class='doccomment'>/// let _ = App::new("app")</span>
|
||||
<span class='doccomment'>/// .args_from_usage("--set-ver [ver] 'set the version manually'</span>
|
||||
<span class='doccomment'>/// --major 'auto increase major'</span>
|
||||
<span class='doccomment'>/// --minor 'auto increase minor'</span>
|
||||
|
@ -369,7 +379,7 @@
|
|||
<span class='self'>self</span>
|
||||
}
|
||||
|
||||
<span class='doccomment'>/// Adds multiple arguments to this group by name inside a Vec</span>
|
||||
<span class='doccomment'>/// Adds multiple arguments to this group by name using a Vec</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// # Example</span>
|
||||
|
@ -409,8 +419,8 @@
|
|||
}
|
||||
|
||||
<span class='doccomment'>/// Sets the requirement rules of this group. This is not to be confused with a required group.</span>
|
||||
<span class='doccomment'>/// Requirement rules function just like argument requirement rules, you can name other arguments</span>
|
||||
<span class='doccomment'>/// or groups that must be present when one of the arguments from this group is used.</span>
|
||||
<span class='doccomment'>/// Requirement rules function just like argument requirement rules, you can name other</span>
|
||||
<span class='doccomment'>/// arguments or groups that must be present when one of the arguments from this group is used.</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// **NOTE:** The name provided may be an argument, or group name</span>
|
||||
<span class='doccomment'>///</span>
|
||||
|
@ -436,8 +446,8 @@
|
|||
}
|
||||
|
||||
<span class='doccomment'>/// Sets the requirement rules of this group. This is not to be confused with a required group.</span>
|
||||
<span class='doccomment'>/// Requirement rules function just like argument requirement rules, you can name other arguments</span>
|
||||
<span class='doccomment'>/// or groups that must be present when one of the arguments from this group is used.</span>
|
||||
<span class='doccomment'>/// Requirement rules function just like argument requirement rules, you can name other</span>
|
||||
<span class='doccomment'>/// arguments or groups that must be present when one of the arguments from this group is used.</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// **NOTE:** The names provided may be an argument, or group name</span>
|
||||
<span class='doccomment'>///</span>
|
||||
|
@ -458,9 +468,9 @@
|
|||
<span class='self'>self</span>
|
||||
}
|
||||
|
||||
<span class='doccomment'>/// Sets the exclusion rules of this group. Exclusion rules function just like argument exclusion </span>
|
||||
<span class='doccomment'>/// rules, you can name other arguments or groups that must not be present when one of the arguments</span>
|
||||
<span class='doccomment'>/// from this group are used.</span>
|
||||
<span class='doccomment'>/// Sets the exclusion rules of this group. Exclusion rules function just like argument </span>
|
||||
<span class='doccomment'>/// exclusion rules, you can name other arguments or groups that must not be present when one</span>
|
||||
<span class='doccomment'>/// of the arguments from this group are used.</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// **NOTE:** The name provided may be an argument, or group name</span>
|
||||
<span class='doccomment'>///</span>
|
||||
|
@ -485,9 +495,9 @@
|
|||
<span class='self'>self</span>
|
||||
}
|
||||
|
||||
<span class='doccomment'>/// Sets the exclusion rules of this group. Exclusion rules function just like argument exclusion </span>
|
||||
<span class='doccomment'>/// rules, you can name other arguments or groups that must not be present when one of the arguments</span>
|
||||
<span class='doccomment'>/// from this group are used.</span>
|
||||
<span class='doccomment'>/// Sets the exclusion rules of this group. Exclusion rules function just like argument</span>
|
||||
<span class='doccomment'>/// exclusion rules, you can name other arguments or groups that must not be present when one</span>
|
||||
<span class='doccomment'>/// of the arguments from this group are used.</span>
|
||||
<span class='doccomment'>///</span>
|
||||
<span class='doccomment'>/// **NOTE:** The names provided may be an argument, or group name</span>
|
||||
<span class='doccomment'>///</span>
|
||||
|
|
|
@ -974,6 +974,44 @@
|
|||
<span id="932">932</span>
|
||||
<span id="933">933</span>
|
||||
<span id="934">934</span>
|
||||
<span id="935">935</span>
|
||||
<span id="936">936</span>
|
||||
<span id="937">937</span>
|
||||
<span id="938">938</span>
|
||||
<span id="939">939</span>
|
||||
<span id="940">940</span>
|
||||
<span id="941">941</span>
|
||||
<span id="942">942</span>
|
||||
<span id="943">943</span>
|
||||
<span id="944">944</span>
|
||||
<span id="945">945</span>
|
||||
<span id="946">946</span>
|
||||
<span id="947">947</span>
|
||||
<span id="948">948</span>
|
||||
<span id="949">949</span>
|
||||
<span id="950">950</span>
|
||||
<span id="951">951</span>
|
||||
<span id="952">952</span>
|
||||
<span id="953">953</span>
|
||||
<span id="954">954</span>
|
||||
<span id="955">955</span>
|
||||
<span id="956">956</span>
|
||||
<span id="957">957</span>
|
||||
<span id="958">958</span>
|
||||
<span id="959">959</span>
|
||||
<span id="960">960</span>
|
||||
<span id="961">961</span>
|
||||
<span id="962">962</span>
|
||||
<span id="963">963</span>
|
||||
<span id="964">964</span>
|
||||
<span id="965">965</span>
|
||||
<span id="966">966</span>
|
||||
<span id="967">967</span>
|
||||
<span id="968">968</span>
|
||||
<span id="969">969</span>
|
||||
<span id="970">970</span>
|
||||
<span id="971">971</span>
|
||||
<span id="972">972</span>
|
||||
</pre><pre class='rust '>
|
||||
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>crate_type</span><span class='op'>=</span> <span class='string'>"lib"</span>]</span>
|
||||
|
||||
|
@ -984,15 +1022,15 @@
|
|||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! Command Line Argument Parser for Rust</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! It is a simple to use and efficient library for parsing command line arguments and subcommands when writing console, or terminal applications.</span>
|
||||
<span class='doccomment'>//! It is a simple to use, efficient, and full featured library for parsing command line arguments and subcommands when writing console, or terminal applications.</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ## About</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! `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.</span>
|
||||
<span class='doccomment'>//! `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.</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! `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).</span>
|
||||
<span class='doccomment'>//! `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.</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! 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.</span>
|
||||
<span class='doccomment'>//! 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.</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ## Features</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
|
@ -1003,14 +1041,14 @@
|
|||
<span class='doccomment'>//! * **Flags / Switches** (i.e. bool fields)</span>
|
||||
<span class='doccomment'>//! - Both short and long versions supported (i.e. `-f` and `--flag` respectively)</span>
|
||||
<span class='doccomment'>//! - Supports combining short versions (i.e. `-fBgoZ` is the same as `-f -B -g -o -Z`)</span>
|
||||
<span class='doccomment'>//! - Optionally supports multiple occurrences (i.e. `myprog -vvv` or `myprog -v -v -v`)</span>
|
||||
<span class='doccomment'>//! - Optionally supports multiple occurrences (i.e. `-vvv` or `-v -v -v`)</span>
|
||||
<span class='doccomment'>//! * **Positional Arguments** (i.e. those which are based off an index from the program name)</span>
|
||||
<span class='doccomment'>//! - Optionally supports multiple values (i.e. `myprog <file>...` such as `myprog file1.txt file2.txt` being two values for the same "file" argument)</span>
|
||||
<span class='doccomment'>//! - Optionally supports Specific Value Sets (See below)</span>
|
||||
<span class='doccomment'>//! - Supports the unix `--` meaning, only positional arguments follow</span>
|
||||
<span class='doccomment'>//! * **Option Arguments** (i.e. those that take values as options)</span>
|
||||
<span class='doccomment'>//! - Both short and long versions supported (i.e. `-o value` and `--option value` or `--option=value` respectively)</span>
|
||||
<span class='doccomment'>//! - Optionally supports multiple values (i.e. `myprog -o <value> -o <other_value>`)</span>
|
||||
<span class='doccomment'>//! - Optionally supports multiple values (i.e. `-o <value> -o <other_value>`)</span>
|
||||
<span class='doccomment'>//! - Optionally supports Specific Value Sets (See below)</span>
|
||||
<span class='doccomment'>//! * **Sub-Commands** (i.e. `git add <file>` where `add` is a sub-command of `git`)</span>
|
||||
<span class='doccomment'>//! - Support their own sub-arguments, and sub-sub-commands independant of the parent</span>
|
||||
|
@ -1019,9 +1057,11 @@
|
|||
<span class='doccomment'>//! - Required by default</span>
|
||||
<span class='doccomment'>//! - Required only if certain arguments are present</span>
|
||||
<span class='doccomment'>//! - Can require other arguments to be present</span>
|
||||
<span class='doccomment'>//! * **Exclusion Rules**: Arguments can optionally define the following types of exclusion rules</span>
|
||||
<span class='doccomment'>//! * **Exclusion/Confliction Rules**: Arguments can optionally define the following types of exclusion rules</span>
|
||||
<span class='doccomment'>//! - Can be disallowed when certain arguments are present</span>
|
||||
<span class='doccomment'>//! - Can disallow use of other arguments when present</span>
|
||||
<span class='doccomment'>//! * **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</span>
|
||||
<span class='doccomment'>//! - 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</span>
|
||||
<span class='doccomment'>//! * **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`)</span>
|
||||
<span class='doccomment'>//! * **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)</span>
|
||||
<span class='doccomment'>//! * **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)</span>
|
||||
|
@ -1029,12 +1069,15 @@
|
|||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ## Quick Example</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! 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.</span>
|
||||
<span class='doccomment'>//! 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.</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! *NOTE:* Both examples are functionally the same, but show two different ways to use `clap`</span>
|
||||
<span class='doccomment'>//! *NOTE:* Both examples are functionally the same, but show two different styles in which to use `clap`</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ```rust</span>
|
||||
<span class='doccomment'>//! // (Full example with detailed comments in examples/01a_QuickExample.rs)</span>
|
||||
<span class='doccomment'>//! //</span>
|
||||
<span class='doccomment'>//! // This example demonstrates clap's "usage strings" method of creating arguments which is less</span>
|
||||
<span class='doccomment'>//! // less verbose</span>
|
||||
<span class='doccomment'>//! extern crate clap;</span>
|
||||
<span class='doccomment'>//! use clap::{Arg, App, SubCommand};</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
|
@ -1089,6 +1132,10 @@
|
|||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ```rust</span>
|
||||
<span class='doccomment'>//! // (Full example with detailed comments in examples/01b_QuickExample.rs)</span>
|
||||
<span class='doccomment'>//! //</span>
|
||||
<span class='doccomment'>//! // This example demonstrates clap's full 'builder pattern' style of creating arguments which is </span>
|
||||
<span class='doccomment'>//! // more verbose, but allows easier editting, and at times more advanced options, or the possibility</span>
|
||||
<span class='doccomment'>//! // to generate arguments dynamically.</span>
|
||||
<span class='doccomment'>//! extern crate clap;</span>
|
||||
<span class='doccomment'>//! use clap::{Arg, App, SubCommand};</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
|
@ -1167,7 +1214,7 @@
|
|||
<span class='doccomment'>//! -v, --version Prints version information</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! OPTIONS:</span>
|
||||
<span class='doccomment'>//! -c, --config=CONFIG Sets a custom config file</span>
|
||||
<span class='doccomment'>//! -c, --config <CONFIG> Sets a custom config file</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! POSITIONAL ARGUMENTS:</span>
|
||||
<span class='doccomment'>//! INPUT The input file to use</span>
|
||||
|
@ -1179,9 +1226,38 @@
|
|||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! *NOTE:* You could also run `myapp test --help` to see similar output and options for the `test` subcommand.</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ## Installation</span>
|
||||
<span class='doccomment'>//! ## Try it!</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! Add `clap` as a dependecy in your `Cargo.toml` file to use from crates.io:</span>
|
||||
<span class='doccomment'>//! ### Pre-Built Test</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! To try out the pre-built example use the following stes:</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! * Clone the repostiory `$ git clone https://github.com/kbknapp/clap-rs && cd clap-rs/clap-tests`</span>
|
||||
<span class='doccomment'>//! * Compile the example `$ cargo build --release`</span>
|
||||
<span class='doccomment'>//! * Run the help info `$ ./target/release/claptests --help`</span>
|
||||
<span class='doccomment'>//! * Play with the arguments!</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ### BYOB (Build Your Own Binary)</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! To test out `clap`'s default auto-generated help/version follow these steps</span>
|
||||
<span class='doccomment'>//! * Create a new cargo project `$ cargo new fake --bin && cd fake`</span>
|
||||
<span class='doccomment'>//! * Add `clap` to your `Cargo.toml` `$ echo '[dependencies]\nclap = "*"' >> Cargo.toml`</span>
|
||||
<span class='doccomment'>//! * Add the following to your `src/main.rs`</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ```rust</span>
|
||||
<span class='doccomment'>//! extern crate clap;</span>
|
||||
<span class='doccomment'>//! use clap::App;</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! fn main() {</span>
|
||||
<span class='doccomment'>//! let _ = App::new("fake").version("v1.0-beta").get_matches();</span>
|
||||
<span class='doccomment'>//! }</span>
|
||||
<span class='doccomment'>//! ```</span>
|
||||
<span class='doccomment'>//! * Build your program `$ cargo build --release`</span>
|
||||
<span class='doccomment'>//! * Run with help or version `$ ./target/release/fake --help` or `$ ./target/release/fake --version`</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ## Usage</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! For full usage, add `clap` as a dependecy in your `Cargo.toml` file to use from crates.io:</span>
|
||||
<span class='doccomment'>//! </span>
|
||||
<span class='doccomment'>//! ```</span>
|
||||
<span class='doccomment'>//! [dependencies]</span>
|
||||
|
|
Loading…
Reference in a new issue