chore(docs): rebuild documentation

This commit is contained in:
Kevin K 2015-04-13 22:19:29 -04:00
parent b389743672
commit 3c217b22b9
12 changed files with 314 additions and 177 deletions

View file

@ -1 +1 @@
initSidebarItems({"struct":[["App","Used to create a representation of the program and all possible command line arguments for parsing at runtime."]]});
initSidebarItems({"struct":[["App","Used to create a representation of a command line program and all possible command line arguments for parsing at runtime."]]});

View file

@ -360,8 +360,8 @@ SUBCOMMANDS:
<tr>
<td><a class='stability Unmarked' title='No stability level'></a><a class='struct' href='struct.App.html'
title='clap::App'>App</a></td>
<td class='docblock short'><p>Used to create a representation of the program and all possible command line arguments
for parsing at runtime.</p>
<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>
</tr>

View file

@ -1 +1 @@
initSidebarItems({"struct":[["App","Used to create a representation of the 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."],["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."]]});
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."],["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."]]});

View file

@ -43,14 +43,18 @@
<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>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-35' href='../src/clap/app.rs.html#39-66'>[src]</a></span></h1>
</span><a id='src-35' href='../src/clap/app.rs.html#43-74'>[src]</a></span></h1>
<pre class='rust struct'>pub struct App&lt;'a, 'v, 'ab, 'u, 'ar&gt; {
// some fields omitted
}</pre><div class='docblock'><p>Used to create a representation of the program and all possible command line arguments
for parsing at runtime.</p>
}</pre><div class='docblock'><p>Used to create a representation of a command line program and all possible command line
arguments for parsing at runtime.</p>
<p>Stores a list of all posisble arguments, as well as information displayed to the user such as
help and versioning information.</p>
<p>Application settings are set using the &quot;builder pattern&quot; with <code>.get_matches()</code> being the
terminal method that starts the runtime-parsing process and returns information about
the user supplied arguments (or lack there of).</p>
<p>The options set for the application are not mandatory, and may appear in any order (so
long as <code>.get_matches()</code> is last).</p>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
@ -59,7 +63,7 @@ help and versioning information.</p>
.<span class='ident'>version</span>(<span class='string'>&quot;1.0.2&quot;</span>)
.<span class='ident'>about</span>(<span class='string'>&quot;Explains in brief what the program does&quot;</span>)
.<span class='ident'>arg</span>(
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;in_file&quot;</span>).<span class='ident'>index</span>(<span class='number'>1</span>)
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>&quot;in_file&quot;</span>).<span class='ident'>index</span>(<span class='number'>1</span>)
<span class='comment'>// Add other possible command line argument options here...</span>
)
.<span class='ident'>get_matches</span>();
@ -67,15 +71,17 @@ help and versioning information.</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&lt;'a, 'v, 'ab, 'u, 'ar&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</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>&lt;'n&gt;(n: &amp;'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</code></h4>
<div class='docblock'><p>Creates a new instance of an application requiring a name (such as the binary). Will be displayed
to the user when they print version or help and usage information.</p>
<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 &#39;-&#39; are ok).</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='ident'>prog</span> <span class='op'>=</span> <span class='ident'>App</span>::<span class='ident'>new</span>(<span class='string'>&quot;myprog&quot;</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: &amp;'a <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</code></h4>
<div class='docblock'><p>Sets a string of author(s) and will be showed to the user when displaying help inofrmation</p>
<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>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
@ -98,9 +104,9 @@ information.</p>
.<span class='ident'>version</span>(<span class='string'>&quot;v0.1.24&quot;</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: &amp;'u <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</code></h4>
<div class='docblock'><p>Sets a custom usage string to over-ride the one auto-generated by <code>clap</code>. Will be
<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>.usage()</code> of <code>ArgMatches</code></p>
<code>ArgMatches::usage()</code></p>
<p><em>NOTE:</em> You do not need to specify the &quot;USAGE: \n\t&quot; portion, as that will
still be applied by <code>clap</code>, you only need to specify the portion starting
@ -114,33 +120,50 @@ showing the usage.</p>
.<span class='ident'>usage</span>(<span class='string'>&quot;myapp [-clDas] &lt;some_file&gt;&quot;</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>&lt;'l, 'h, 'b, 'r&gt;(self, a: <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'ar, 'ar, 'ar, 'ar, 'ar, 'ar&gt;) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</code></h4>
<div class='docblock'><p>Adds an argument to the list of valid possibilties</p>
<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
(exclusions and requirements).</p>
<p>The only disadvantage to this method is that it&#39;s more verbose, and arguments must be added
one at a time. Using <code>Arg::from_usage</code> helps with the verbosity, and still allows full
control over the advanced configuration options.</p>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;config&quot;</span>)
.<span class='ident'>short</span>(<span class='string'>&quot;c&quot;</span>)
<span class='comment'>// Additional argument configuration goes here...</span>
)
<span class='comment'>// Adding a single &quot;flag&quot; argument with a short and help text, using Arg::with_name()</span>
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>&quot;debug&quot;</span>)
.<span class='ident'>short</span>(<span class='string'>&quot;d&quot;</span>)
.<span class='ident'>help</span>(<span class='string'>&quot;turns on debugging mode&quot;</span>))
<span class='comment'>// Adding a single &quot;option&quot; 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'>&quot;-c --config=[CONFIG] &#39;Optionally sets a configuration file to use&#39;&quot;</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>&lt;<a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'ar, 'ar, 'ar, 'ar, 'ar, 'ar&gt;&gt;) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</code></h4>
<div class='docblock'><p>Adds multiple arguments to the list of valid possibilties</p>
<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
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>args</span>( <span class='macro'>vec</span><span class='macro'>!</span>[<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;config&quot;</span>).<span class='ident'>short</span>(<span class='string'>&quot;c&quot;</span>),
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;debug&quot;</span>).<span class='ident'>short</span>(<span class='string'>&quot;d&quot;</span>)])
.<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'>&quot;[debug] -d &#39;turns on debugging info&quot;</span>),
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>&quot;input&quot;</span>).<span class='ident'>index</span>(<span class='number'>1</span>).<span class='ident'>help</span>(<span class='string'>&quot;the input file to use&quot;</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: &amp;'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</code></h4>
<div class='docblock'><p>Adds an argument from a usage string. See Arg::from_usage() for details</p>
<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>
<p>The downside to using this method is that you can not set any additional properties of the
<code>Arg</code> other than what <code>Arg::from_usage()</code> supports.</p>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>arg_from_usage</span>(<span class='string'>&quot;-c --conf=&lt;config&gt; &#39;Sets a configuration file to use&#39;&quot;</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: &amp;'ar <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</code></h4>
<div class='docblock'><p>Adds multiple arguments from a usage string, one per line. See Arg::from_usage() for
details</p>
<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>
<p>Like <code>App::arg_from_usage()</code> the downside is you only set properties for the <code>Arg</code>s which
<code>Arg::from_usage()</code> supports. But here the benefit is pretty strong, as the readability is
greatly enhanced, especially if you don&#39;t need any of the more advanced configuration options.</p>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
@ -152,26 +175,23 @@ details</p>
</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>&lt;'a, 'v, 'ab, 'u, 'ar&gt;) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</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 and version
switches.</p>
function just like apps, in that they get their own auto generated help, version, and usage.</p>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>subcommand</span>(<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>&quot;config&quot;</span>)
.<span class='ident'>about</span>(<span class='string'>&quot;Controls configuration features&quot;</span>)
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;config_file&quot;</span>)
.<span class='ident'>index</span>(<span class='number'>1</span>)
.<span class='ident'>help</span>(<span class='string'>&quot;Configuration file to use&quot;</span>)))
<span class='comment'>// Additional subcommand configuration goes here, such as arguments...</span>
.<span class='ident'>arg_from_usage</span>(<span class='string'>&quot;&lt;config&gt; &#39;Required configuration file to use&#39;&quot;</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>&lt;<a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;&gt;) -&gt; <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>&lt;'a, 'v, 'ab, 'u, 'ar&gt;</code></h4>
<div class='docblock'><p>Adds multiple subcommands to the list of valid possibilties</p>
<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
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>subcommands</span>( <span class='macro'>vec</span><span class='macro'>!</span>[
<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>&quot;config&quot;</span>).<span class='ident'>about</span>(<span class='string'>&quot;Controls configuration functionality&quot;</span>)
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;config_file&quot;</span>).<span class='ident'>index</span>(<span class='number'>1</span>)),
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>&quot;config_file&quot;</span>).<span class='ident'>index</span>(<span class='number'>1</span>)),
<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>&quot;debug&quot;</span>).<span class='ident'>about</span>(<span class='string'>&quot;Controls debug functionality&quot;</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) -&gt; <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a>&lt;'ar&gt;</code></h4>

View file

@ -43,7 +43,7 @@
<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>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-8420' href='../src/clap/args/arg.rs.html#23-68'>[src]</a></span></h1>
</span><a id='src-8427' href='../src/clap/args/arg.rs.html#31-76'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Arg&lt;'n, 'l, 'h, 'b, 'p, 'r&gt; {
// some fields omitted
}</pre><div class='docblock'><p>The abstract representation of a command line argument used by the consumer of the library.
@ -53,13 +53,20 @@ Used to set all the options and relationships that define a valid argument for t
their program. Then evaluates the settings the consumer provided and determines the concret
argument type to use when parsing.</p>
<p>There are two methods for constructing <code>Arg</code>s, using the builder pattern and setting options
manually, or using a usage string which is far less verbose. You can also use a combination
of the two methods to achieve the best of both worlds.</p>
<h1 id="example" class='section-header'><a
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'>&quot;conifg&quot;</span>)
<span class='comment'>// Using the traditional builder pattern and setting each option manually</span>
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>&quot;conifg&quot;</span>)
.<span class='ident'>short</span>(<span class='string'>&quot;c&quot;</span>)
.<span class='ident'>long</span>(<span class='string'>&quot;config&quot;</span>)
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>)
.<span class='ident'>help</span>(<span class='string'>&quot;Provides a config file to myprog&quot;</span>)
<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'>&quot;-i --input=[input] &#39;Provides an input file to the program&#39;&quot;</span>)
</pre>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl&lt;'n, 'l, 'h, 'b, 'p, 'r&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</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: &amp;'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
<div class='docblock'><p>Creates a new instace of <code>Arg</code> using a unique string name.
@ -70,11 +77,11 @@ whether or not the argument was used at runtime. </p>
and positional arguments (i.e. those without a <code>-</code> or <code>--</code>) the name will also
be displayed when the user prints the usage/help information of the program.</p>
<p><strong>NOTE:</strong> this function is deprecated in favor of Arg::with_name() to stay in line with
<p><strong>NOTE:</strong> this function is deprecated in favor of Arg::with_name() to stay consistant with
Rust APIs</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
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'>&quot;conifg&quot;</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: &amp;'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -86,40 +93,42 @@ whether or not the argument was used at runtime. </p>
and positional arguments (i.e. those without a <code>-</code> or <code>--</code>) the name will also
be displayed when the user prints the usage/help information of the program.</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
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'>&quot;conifg&quot;</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: &amp;'n <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'n, 'n, 'b, 'p, 'r&gt;</code></h4>
<div class='docblock'><p>Creates a new instace of <code>Arg</code> using a usage string. Allows creation of basic settings
<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>
<p>The syntax should be as follows (only properties which you wish to set must be present):</p>
<p><strong>NOTE</strong>: only properties which you wish to set must be present</p>
<ol>
<li>Name (arguments with a <code>long</code> or that take a value can ommit this if desired),
use <code>[]</code> for non-required arguments, or <code>&lt;&gt;</code> for required arguments.</li>
<li>Short preceded by a <code>-</code></li>
<li>Long preceded by a <code>--</code> (this may be used as the name, if the name is omitted. If the
name is <em>not</em> omittied, the name takes precedence)</li>
<li>Value (this can be used as the name, if the name is not manually specified. If the name
is manually specified, it takes precence. If this value is used as the name, it uses the
same <code>[]</code> and <code>&lt;&gt;</code> requirement rules. If it is <em>not</em> used as the name, it still needs to
be surrounded by either <code>[]</code> or <code>&lt;&gt;</code> but the effect is the same, as the requirement rule
is determined by the name. The value may follow the <code>short</code> or <code>long</code>. If it
follows the <code>long</code>, it may follow either a <code>=</code> or <code></code> with the same effect, personal
preference only, but may only follow a <code></code> after a <code>short</code>)</li>
<li>Multiple specifier <code>...</code> (for flags or positional arguments the <code>...</code> may follow the
name or <code>short</code> or <code>long</code>)</li>
<li>The help info surrounded by <code>&#39;</code></li>
name is <em>not</em> omittied, the name takes precedence over the <code>long</code>)</li>
<li>Value (this can be used as the name if the name is not manually specified. If the name
is manually specified, it takes precedence. If this value is used as the name, it uses the
same <code>[]</code> and <code>&lt;&gt;</code> requirement specification rules. If it is <em>not</em> used as the name, it
still needs to be surrounded by either <code>[]</code> or <code>&lt;&gt;</code> but there is no requirement effect,
as the requirement rule is determined by the real name. This value may follow the <code>short</code>
or <code>long</code>, it doesn&#39;t matter. If it follows the <code>long</code>, it may follow either a <code>=</code> or <code></code>
there is no difference, just personal preference. If this follows a <code>short</code> it can only
be after a <code></code>) i.e. <code>-c [name]</code>, <code>--config [name]</code>, <code>--config=[name]</code>, etc.</li>
<li>Multiple specifier <code>...</code> (the <code>...</code> may follow the name, <code>short</code>, <code>long</code>, or value <em>without</em>
a <code></code> space) i.e. <code>&lt;name&gt;... -c</code>, <code>--config &lt;name&gt;...</code>, <code>[name] -c...</code>, etc.</li>
<li>The help info surrounded by <code>&#39;</code>s (single quotes)</li>
<li>The index of a positional argument will be the next available index (you don&#39;t need to
specify one)</li>
specify one) i.e. all arguments without a <code>short</code> or <code>long</code> will be treated as positional</li>
</ol>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>args</span>(<span class='macro'>vec</span><span class='macro'>!</span>[
<span class='comment'>// A option argument with a long, named &quot;conf&quot; (note: because the name was specified</span>
<span class='comment'>// the portion after the long can be called anything, only the first name will be displayed</span>
<span class='comment'>// to the user. Also, requirement is set with the *name*, so the portion after the long could</span>
@ -127,11 +136,14 @@ specify one)</li>
<span class='comment'>// omitted, the name would have been derived from the portion after the long and those rules</span>
<span class='comment'>// would have mattered)</span>
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>&quot;[conf] --config=[c] &#39;a required file for the configuration&#39;&quot;</span>),
<span class='comment'>// A flag with a short, a long, named &quot;debug&quot;, and accepts multiple values</span>
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>&quot;-d --debug... &#39;turns on debugging information&quot;</span>),
<span class='comment'>// A required positional argument named &quot;input&quot;</span>
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>&quot;&lt;input&gt; &#39;the input file to use&#39;&quot;</span>)
])
<span class='attribute'>#
</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: &amp;<a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
<div class='docblock'><p>Sets the short version of the argument without the preceding <code>-</code>.</p>
@ -141,10 +153,10 @@ respectivly. You may use <code>v</code> or <code>h</code> for your own purposes,
will not asign those to the displaying of version or help.</p>
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped, and only the first
non <code>-</code> chacter will be used as the <code>short</code> version, i.e. for when the user
mistakenly sets the short to <code>-o</code> or the like.
Example:</p>
<pre id='rust-example-rendered' class='rust '>
non <code>-</code> chacter will be used as the <code>short</code> version</p>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>short</span>(<span class='string'>&quot;c&quot;</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: &amp;'l <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -155,19 +167,18 @@ respectivly. You may use <code>version</code> or <code>help</code> for your own
will not asign those to the displaying of version or help automatically, and you will have to do
so manually.</p>
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped i.e. for
when the user mistakenly sets the short to <code>--out</code> or the like.</p>
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>long</span>(<span class='string'>&quot;config&quot;</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: &amp;'h <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</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>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>help</span>(<span class='string'>&quot;The config file used by the myprog&quot;</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>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -180,8 +191,8 @@ by default.</p>
cannot be required by default.
when they print the usage/help information. </p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
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: &amp;'b <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -192,8 +203,8 @@ the following argument can&#39;t be present.</p>
by default. Mutually exclusive rules only need to be set for one of the two
arguments, they do not need to be set for each.</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>mutually_excludes</span>(<span class='string'>&quot;debug&quot;</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>&lt;&amp;'b <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -204,8 +215,8 @@ the following argument can&#39;t be present.</p>
by default. Mutually exclusive rules only need to be set for one of the two
arguments, they do not need to be set for each.</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>mutually_excludes_all</span>(
<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>&quot;debug&quot;</span>, <span class='string'>&quot;input&quot;</span>])
</pre>
@ -215,8 +226,8 @@ using this argument, the following argument <em>must</em> be present.</p>
<p><strong>NOTE:</strong> Mutually exclusive rules take precedence over being required</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
.<span class='ident'>requires</span>(<span class='string'>&quot;debug&quot;</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>&lt;&amp;'r <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -226,8 +237,8 @@ using this argument, the following arguments <em>must</em> be present.</p>
<p><strong>NOTE:</strong> Mutually exclusive rules take precedence over being required
by default. </p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
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'>&quot;debug&quot;</span>, <span class='string'>&quot;input&quot;</span>])
</pre>
@ -237,8 +248,8 @@ by default. </p>
<p><strong>NOTE:</strong> When setting this to <code>true</code> the <code>name</code> of the argument
will be used when printing the help/usage information to the user. </p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
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>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -249,8 +260,8 @@ are ignored as positional arguments cannot have a <code>short</code> or <code>lo
Also, the name will be used when printing the help/usage information
to the user. </p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
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>) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -262,8 +273,8 @@ of a particular flag at runtime.</p>
<p><strong>NOTE:</strong> When setting this, any <code>takes_value</code> or <code>index</code> values you set
are ignored as flags cannot have a values or an <code>index</code>.</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
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>&lt;&amp;'p <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;) -&gt; <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&lt;'n, 'l, 'h, 'b, 'p, 'r&gt;</code></h4>
@ -272,8 +283,8 @@ one of the specified values was used, or fails with a usage string.</p>
<p><strong>NOTE:</strong> This setting only applies to options and positional arguments </p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<h1 id="example" class='section-header'><a
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'>&quot;fast&quot;</span>, <span class='string'>&quot;slow&quot;</span>])
</pre>
</div></div></section>

View file

@ -43,7 +43,7 @@
<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>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-9280' href='../src/clap/args/argmatches.rs.html#57-68'>[src]</a></span></h1>
</span><a id='src-9287' href='../src/clap/args/argmatches.rs.html#57-68'>[src]</a></span></h1>
<pre class='rust struct'>pub struct ArgMatches&lt;'a&gt; {
// some fields omitted
}</pre><div class='docblock'><p>Used to get information about the arguments that where supplied to the program at runtime by

View file

@ -43,7 +43,7 @@
<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>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-9771' href='../src/clap/args/subcommand.rs.html#23-26'>[src]</a></span></h1>
</span><a id='src-9778' href='../src/clap/args/subcommand.rs.html#23-26'>[src]</a></span></h1>
<pre class='rust struct'>pub struct SubCommand&lt;'a&gt; {
pub name: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>,
pub matches: <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a>&lt;'a&gt;,

View file

@ -468,8 +468,6 @@
if ($active.length) {
document.location.href = $active.find('a').prop('href');
}
} else {
$active.removeClass('highlighted');
}
});
}
@ -715,13 +713,11 @@
if (crates[i] == window.currentCrate) {
klass += ' current';
}
if (rawSearchIndex[crates[i]].items[0]) {
var desc = rawSearchIndex[crates[i]].items[0][3];
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
'title': plainSummaryLine(desc),
'class': klass}).text(crates[i]));
}
}
sidebar.append(div);
}
}

File diff suppressed because one or more lines are too long

View file

@ -1343,6 +1343,36 @@
<span id="1301">1301</span>
<span id="1302">1302</span>
<span id="1303">1303</span>
<span id="1304">1304</span>
<span id="1305">1305</span>
<span id="1306">1306</span>
<span id="1307">1307</span>
<span id="1308">1308</span>
<span id="1309">1309</span>
<span id="1310">1310</span>
<span id="1311">1311</span>
<span id="1312">1312</span>
<span id="1313">1313</span>
<span id="1314">1314</span>
<span id="1315">1315</span>
<span id="1316">1316</span>
<span id="1317">1317</span>
<span id="1318">1318</span>
<span id="1319">1319</span>
<span id="1320">1320</span>
<span id="1321">1321</span>
<span id="1322">1322</span>
<span id="1323">1323</span>
<span id="1324">1324</span>
<span id="1325">1325</span>
<span id="1326">1326</span>
<span id="1327">1327</span>
<span id="1328">1328</span>
<span id="1329">1329</span>
<span id="1330">1330</span>
<span id="1331">1331</span>
<span id="1332">1332</span>
<span id="1333">1333</span>
</pre><pre class='rust '>
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>collections</span>::<span class='ident'>BTreeMap</span>;
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>collections</span>::<span class='ident'>BTreeSet</span>;
@ -1359,12 +1389,16 @@
<span class='kw'>use</span> <span class='ident'>args</span>::{<span class='ident'>OptArg</span>, <span class='ident'>OptBuilder</span>};
<span class='kw'>use</span> <span class='ident'>args</span>::{<span class='ident'>PosArg</span>, <span class='ident'>PosBuilder</span>};
<span class='doccomment'>/// Used to create a representation of the program and all possible command line arguments</span>
<span class='doccomment'>/// for parsing at runtime.</span>
<span class='doccomment'>/// Used to create a representation of a command line program and all possible command line</span>
<span class='doccomment'>/// arguments for parsing at runtime.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Application settings are set using the &quot;builder pattern&quot; with `.get_matches()` being the</span>
<span class='doccomment'>/// terminal method that starts the runtime-parsing process and returns information about</span>
<span class='doccomment'>/// the user supplied arguments (or lack there of).</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// The options set for the application are not mandatory, and may appear in any order (so</span>
<span class='doccomment'>/// long as `.get_matches()` is last).</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Stores a list of all posisble arguments, as well as information displayed to the user such as</span>
<span class='doccomment'>/// help and versioning information.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
@ -1375,7 +1409,7 @@
<span class='doccomment'>/// .version(&quot;1.0.2&quot;)</span>
<span class='doccomment'>/// .about(&quot;Explains in brief what the program does&quot;)</span>
<span class='doccomment'>/// .arg(</span>
<span class='doccomment'>/// Arg::new(&quot;in_file&quot;).index(1)</span>
<span class='doccomment'>/// Arg::with_name(&quot;in_file&quot;).index(1)</span>
<span class='doccomment'>/// // Add other possible command line argument options here...</span>
<span class='doccomment'>/// )</span>
<span class='doccomment'>/// .get_matches();</span>
@ -1391,9 +1425,13 @@
<span class='ident'>version</span>: <span class='prelude-ty'>Option</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;v</span> <span class='ident'>str</span><span class='op'>&gt;</span>,
<span class='comment'>// A brief explaination of the program that gets displayed to the user when shown help/usage information</span>
<span class='ident'>about</span>: <span class='prelude-ty'>Option</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;ab</span> <span class='ident'>str</span><span class='op'>&gt;</span>,
<span class='comment'>// A list of possible flags</span>
<span class='ident'>flags</span>: <span class='ident'>BTreeMap</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;ar</span> <span class='ident'>str</span>, <span class='ident'>FlagBuilder</span><span class='op'>&lt;</span><span class='lifetime'>&#39;ar</span><span class='op'>&gt;&gt;</span>,
<span class='comment'>// A list of possible options</span>
<span class='ident'>opts</span>: <span class='ident'>BTreeMap</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;ar</span> <span class='ident'>str</span>, <span class='ident'>OptBuilder</span><span class='op'>&lt;</span><span class='lifetime'>&#39;ar</span><span class='op'>&gt;&gt;</span>,
<span class='comment'>// A list of positional arguments</span>
<span class='ident'>positionals_idx</span>: <span class='ident'>BTreeMap</span><span class='op'>&lt;</span><span class='ident'>u8</span>, <span class='ident'>PosBuilder</span><span class='op'>&lt;</span><span class='lifetime'>&#39;ar</span><span class='op'>&gt;&gt;</span>,
<span class='comment'>// A list of subcommands</span>
<span class='ident'>subcommands</span>: <span class='ident'>BTreeMap</span><span class='op'>&lt;</span><span class='ident'>String</span>, <span class='ident'>App</span><span class='op'>&lt;</span><span class='lifetime'>&#39;a</span>, <span class='lifetime'>&#39;v</span>, <span class='lifetime'>&#39;ab</span>, <span class='lifetime'>&#39;u</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;&gt;</span>,
<span class='ident'>needs_long_help</span>: <span class='ident'>bool</span>,
<span class='ident'>needs_long_version</span>: <span class='ident'>bool</span>,
@ -1412,8 +1450,10 @@
}
<span class='kw'>impl</span><span class='op'>&lt;</span><span class='lifetime'>&#39;a</span>, <span class='lifetime'>&#39;v</span>, <span class='lifetime'>&#39;ab</span>, <span class='lifetime'>&#39;u</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;</span> <span class='ident'>App</span><span class='op'>&lt;</span><span class='lifetime'>&#39;a</span>, <span class='lifetime'>&#39;v</span>, <span class='lifetime'>&#39;ab</span>, <span class='lifetime'>&#39;u</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;</span>{
<span class='doccomment'>/// Creates a new instance of an application requiring a name (such as the binary). Will be displayed</span>
<span class='doccomment'>/// to the user when they print version or help and usage information.</span>
<span class='doccomment'>/// Creates a new instance of an application requiring a name (such as the binary). The name</span>
<span class='doccomment'>/// will be displayed to the user when they request to print version or help and usage</span>
<span class='doccomment'>/// information. The name should not contain spaces (hyphens &#39;-&#39; are ok).</span>
<span class='doccomment'>///</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
@ -1448,7 +1488,8 @@
}
}
<span class='doccomment'>/// Sets a string of author(s) and will be showed to the user when displaying help inofrmation</span>
<span class='doccomment'>/// Sets a string of author(s) and will be displayed to the user when they request the version</span>
<span class='doccomment'>/// or help information.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
@ -1495,9 +1536,9 @@
<span class='self'>self</span>
}
<span class='doccomment'>/// Sets a custom usage string to over-ride the one auto-generated by `clap`. Will be</span>
<span class='doccomment'>/// Sets a custom usage string to over-ride the auto-generated usage string. Will be</span>
<span class='doccomment'>/// displayed to the user when errors are found in argument parsing, or when you call</span>
<span class='doccomment'>/// `.usage()` of `ArgMatches`</span>
<span class='doccomment'>/// `ArgMatches::usage()`</span>
<span class='doccomment'>/// </span>
<span class='doccomment'>/// *NOTE:* You do not need to specify the &quot;USAGE: \n\t&quot; portion, as that will </span>
<span class='doccomment'>/// still be applied by `clap`, you only need to specify the portion starting</span>
@ -1506,6 +1547,7 @@
<span class='doccomment'>/// *NOTE:* This will not replace the entire help message, *only* the portion</span>
<span class='doccomment'>/// showing the usage.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```no_run</span>
@ -1519,17 +1561,26 @@
<span class='self'>self</span>
}
<span class='doccomment'>/// Adds an argument to the list of valid possibilties</span>
<span class='doccomment'>/// Adds an argument to the list of valid possibilties manually. This method allows you full</span>
<span class='doccomment'>/// control over the arguments settings and options (as well as dynamic generation). It also</span>
<span class='doccomment'>/// allows you specify several more advanced configuration options such as relational rules</span>
<span class='doccomment'>/// (exclusions and requirements).</span>
<span class='doccomment'>/// </span>
<span class='doccomment'>/// The only disadvantage to this method is that it&#39;s more verbose, and arguments must be added</span>
<span class='doccomment'>/// one at a time. Using `Arg::from_usage` helps with the verbosity, and still allows full</span>
<span class='doccomment'>/// control over the advanced configuration options.</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, Arg};</span>
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .arg(Arg::new(&quot;config&quot;)</span>
<span class='doccomment'>/// .short(&quot;c&quot;)</span>
<span class='doccomment'>/// // Additional argument configuration goes here...</span>
<span class='doccomment'>/// )</span>
<span class='doccomment'>/// // Adding a single &quot;flag&quot; argument with a short and help text, using Arg::with_name()</span>
<span class='doccomment'>/// .arg(Arg::with_name(&quot;debug&quot;)</span>
<span class='doccomment'>/// .short(&quot;d&quot;)</span>
<span class='doccomment'>/// .help(&quot;turns on debugging mode&quot;))</span>
<span class='doccomment'>/// // Adding a single &quot;option&quot; argument with a short, a long, and help text using the less verbose Arg::from_usage()</span>
<span class='doccomment'>/// .arg(Arg::from_usage(&quot;-c --config=[CONFIG] &#39;Optionally sets a configuration file to use&#39;&quot;))</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>a</span>: <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;</span>) <span class='op'>-&gt;</span> <span class='ident'>App</span><span class='op'>&lt;</span><span class='lifetime'>&#39;a</span>, <span class='lifetime'>&#39;v</span>, <span class='lifetime'>&#39;ab</span>, <span class='lifetime'>&#39;u</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;</span> {
@ -1693,15 +1744,16 @@
<span class='self'>self</span>
}
<span class='doccomment'>/// Adds multiple arguments to the list of valid possibilties</span>
<span class='doccomment'>/// Adds multiple arguments to the list of valid possibilties by iterating over a Vec of Args</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, Arg};</span>
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .args( vec![Arg::new(&quot;config&quot;).short(&quot;c&quot;),</span>
<span class='doccomment'>/// Arg::new(&quot;debug&quot;).short(&quot;d&quot;)])</span>
<span class='doccomment'>/// .args( vec![Arg::from_usage(&quot;[debug] -d &#39;turns on debugging info&quot;),</span>
<span class='doccomment'>/// Arg::with_name(&quot;input&quot;).index(1).help(&quot;the input file to use&quot;)])</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>args</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>args</span>: <span class='ident'>Vec</span><span class='op'>&lt;</span><span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;&gt;</span>) <span class='op'>-&gt;</span> <span class='ident'>App</span><span class='op'>&lt;</span><span class='lifetime'>&#39;a</span>, <span class='lifetime'>&#39;v</span>, <span class='lifetime'>&#39;ab</span>, <span class='lifetime'>&#39;u</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;</span> {
@ -1711,7 +1763,12 @@
<span class='self'>self</span>
}
<span class='doccomment'>/// Adds an argument from a usage string. See Arg::from_usage() for details</span>
<span class='doccomment'>/// A convienience method for adding a single basic argument (one without advanced relational rules)</span>
<span class='doccomment'>/// from a usage type string. The string used follows the same rules and syntax as `Arg::from_usage()`</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// The downside to using this method is that you can not set any additional properties of the</span>
<span class='doccomment'>/// `Arg` other than what `Arg::from_usage()` supports.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
@ -1726,8 +1783,13 @@
<span class='self'>self</span>
}
<span class='doccomment'>/// Adds multiple arguments from a usage string, one per line. See Arg::from_usage() for</span>
<span class='doccomment'>/// details</span>
<span class='doccomment'>/// Adds multiple arguments at once from a usage string, one per line. See `Arg::from_usage()`</span>
<span class='doccomment'>/// for details on the syntax and rules supported.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Like `App::arg_from_usage()` the downside is you only set properties for the `Arg`s which</span>
<span class='doccomment'>/// `Arg::from_usage()` supports. But here the benefit is pretty strong, as the readability is</span>
<span class='doccomment'>/// greatly enhanced, especially if you don&#39;t need any of the more advanced configuration options.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
@ -1742,7 +1804,7 @@
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>args_from_usage</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>usage</span>: <span class='kw-2'>&amp;</span><span class='lifetime'>&#39;ar</span> <span class='ident'>str</span>) <span class='op'>-&gt;</span> <span class='ident'>App</span><span class='op'>&lt;</span><span class='lifetime'>&#39;a</span>, <span class='lifetime'>&#39;v</span>, <span class='lifetime'>&#39;ab</span>, <span class='lifetime'>&#39;u</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;</span> {
<span class='kw'>for</span> <span class='ident'>l</span> <span class='kw'>in</span> <span class='ident'>usage</span>.<span class='ident'>lines</span>() {
<span class='self'>self</span> <span class='op'>=</span> <span class='self'>self</span>.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='ident'>l</span>));
<span class='self'>self</span> <span class='op'>=</span> <span class='self'>self</span>.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='ident'>l</span>.<span class='ident'>trim</span>()));
}
<span class='self'>self</span>
}
@ -1750,8 +1812,8 @@
<span class='doccomment'>/// Adds a subcommand to the list of valid possibilties. Subcommands are effectively sub apps,</span>
<span class='doccomment'>/// because they can contain their own arguments, subcommands, version, usage, etc. They also</span>
<span class='doccomment'>/// function just like apps, in that they get their own auto generated help and version</span>
<span class='doccomment'>/// switches.</span>
<span class='doccomment'>/// function just like apps, in that they get their own auto generated help, version, and usage.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
@ -1760,10 +1822,8 @@
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .subcommand(SubCommand::new(&quot;config&quot;)</span>
<span class='doccomment'>/// .about(&quot;Controls configuration features&quot;)</span>
<span class='doccomment'>/// .arg(Arg::new(&quot;config_file&quot;)</span>
<span class='doccomment'>/// .index(1)</span>
<span class='doccomment'>/// .help(&quot;Configuration file to use&quot;)))</span>
<span class='doccomment'>/// // Additional subcommand configuration goes here, such as arguments...</span>
<span class='doccomment'>/// .arg_from_usage(&quot;&lt;config&gt; &#39;Required configuration file to use&#39;&quot;)))</span>
<span class='doccomment'>/// // Additional subcommand configuration goes here, such as other arguments...</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>subcommand</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>subcmd</span>: <span class='ident'>App</span><span class='op'>&lt;</span><span class='lifetime'>&#39;a</span>, <span class='lifetime'>&#39;v</span>, <span class='lifetime'>&#39;ab</span>, <span class='lifetime'>&#39;u</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;</span>) <span class='op'>-&gt;</span> <span class='ident'>App</span><span class='op'>&lt;</span><span class='lifetime'>&#39;a</span>, <span class='lifetime'>&#39;v</span>, <span class='lifetime'>&#39;ab</span>, <span class='lifetime'>&#39;u</span>, <span class='lifetime'>&#39;ar</span><span class='op'>&gt;</span> {
@ -1772,7 +1832,7 @@
<span class='self'>self</span>
}
<span class='doccomment'>/// Adds multiple subcommands to the list of valid possibilties</span>
<span class='doccomment'>/// Adds multiple subcommands to the list of valid possibilties by iterating over a Vec of `SubCommand`s</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
@ -1781,7 +1841,7 @@
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .subcommands( vec![</span>
<span class='doccomment'>/// SubCommand::new(&quot;config&quot;).about(&quot;Controls configuration functionality&quot;)</span>
<span class='doccomment'>/// .arg(Arg::new(&quot;config_file&quot;).index(1)),</span>
<span class='doccomment'>/// .arg(Arg::with_name(&quot;config_file&quot;).index(1)),</span>
<span class='doccomment'>/// SubCommand::new(&quot;debug&quot;).about(&quot;Controls debug functionality&quot;)])</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>

View file

@ -560,28 +560,61 @@
<span id="518">518</span>
<span id="519">519</span>
<span id="520">520</span>
<span id="521">521</span>
<span id="522">522</span>
<span id="523">523</span>
<span id="524">524</span>
<span id="525">525</span>
<span id="526">526</span>
<span id="527">527</span>
<span id="528">528</span>
<span id="529">529</span>
<span id="530">530</span>
<span id="531">531</span>
<span id="532">532</span>
<span id="533">533</span>
<span id="534">534</span>
<span id="535">535</span>
<span id="536">536</span>
<span id="537">537</span>
<span id="538">538</span>
<span id="539">539</span>
<span id="540">540</span>
<span id="541">541</span>
<span id="542">542</span>
<span id="543">543</span>
<span id="544">544</span>
<span id="545">545</span>
</pre><pre class='rust '>
<span class='kw'>use</span> <span class='ident'>usageparser</span>::{<span class='ident'>UsageParser</span>, <span class='ident'>UsageToken</span>};
<span class='doccomment'>/// The abstract representation of a command line argument used by the consumer of the library.</span>
<span class='doccomment'>/// Used to set all the options and relationships that define a valid argument for the program.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// This struct is used by the library consumer and describes the command line arguments for </span>
<span class='doccomment'>/// their program. Then evaluates the settings the consumer provided and determines the concret</span>
<span class='doccomment'>/// argument type to use when parsing.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// There are two methods for constructing `Arg`s, using the builder pattern and setting options</span>
<span class='doccomment'>/// manually, or using a usage string which is far less verbose. You can also use a combination</span>
<span class='doccomment'>/// of the two methods to achieve the best of both worlds.</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, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// // Using the traditional builder pattern and setting each option manually</span>
<span class='doccomment'>/// Arg::with_name(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .short(&quot;c&quot;)</span>
<span class='doccomment'>/// .long(&quot;config&quot;)</span>
<span class='doccomment'>/// .takes_value(true)</span>
<span class='doccomment'>/// .help(&quot;Provides a config file to myprog&quot;)</span>
<span class='doccomment'>/// # ).arg(</span>
<span class='doccomment'>/// // Using a usage string (setting a similar argument to the one above)</span>
<span class='doccomment'>/// Arg::from_usage(&quot;-i --input=[input] &#39;Provides an input file to the program&#39;&quot;)</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>struct</span> <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;n</span>, <span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;p</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span> {
<span class='doccomment'>/// The unique name of the argument, required</span>
@ -639,10 +672,11 @@
<span class='doccomment'>/// and positional arguments (i.e. those without a `-` or `--`) the name will also </span>
<span class='doccomment'>/// be displayed when the user prints the usage/help information of the program.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// **NOTE:** this function is deprecated in favor of Arg::with_name() to stay in line with</span>
<span class='doccomment'>/// **NOTE:** this function is deprecated in favor of Arg::with_name() to stay consistant with</span>
<span class='doccomment'>/// Rust APIs</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
@ -677,7 +711,8 @@
<span class='doccomment'>/// and positional arguments (i.e. those without a `-` or `--`) the name will also </span>
<span class='doccomment'>/// be displayed when the user prints the usage/help information of the program.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
@ -702,37 +737,39 @@
}
}
<span class='doccomment'>/// Creates a new instace of `Arg` using a usage string. Allows creation of basic settings</span>
<span class='doccomment'>/// Creates a new instace of `Arg` from a usage string. Allows creation of basic settings</span>
<span class='doccomment'>/// for Arg (i.e. everything except relational rules). The syntax is flexible, but there are</span>
<span class='doccomment'>/// some rules to follow.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// The syntax should be as follows (only properties which you wish to set must be present):</span>
<span class='doccomment'>/// **NOTE**: only properties which you wish to set must be present</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// 1. Name (arguments with a `long` or that take a value can ommit this if desired),</span>
<span class='doccomment'>/// use `[]` for non-required arguments, or `&lt;&gt;` for required arguments.</span>
<span class='doccomment'>/// 2. Short preceded by a `-`</span>
<span class='doccomment'>/// 3. Long preceded by a `--` (this may be used as the name, if the name is omitted. If the</span>
<span class='doccomment'>/// name is *not* omittied, the name takes precedence)</span>
<span class='doccomment'>/// 4. Value (this can be used as the name, if the name is not manually specified. If the name</span>
<span class='doccomment'>/// is manually specified, it takes precence. If this value is used as the name, it uses the</span>
<span class='doccomment'>/// same `[]` and `&lt;&gt;` requirement rules. If it is *not* used as the name, it still needs to</span>
<span class='doccomment'>/// be surrounded by either `[]` or `&lt;&gt;` but the effect is the same, as the requirement rule</span>
<span class='doccomment'>/// is determined by the name. The value may follow the `short` or `long`. If it</span>
<span class='doccomment'>/// follows the `long`, it may follow either a `=` or ` ` with the same effect, personal</span>
<span class='doccomment'>/// preference only, but may only follow a ` ` after a `short`)</span>
<span class='doccomment'>/// 5. Multiple specifier `...` (for flags or positional arguments the `...` may follow the</span>
<span class='doccomment'>/// name or `short` or `long`)</span>
<span class='doccomment'>/// 6. The help info surrounded by `&#39;`</span>
<span class='doccomment'>/// name is *not* omittied, the name takes precedence over the `long`)</span>
<span class='doccomment'>/// 4. Value (this can be used as the name if the name is not manually specified. If the name</span>
<span class='doccomment'>/// is manually specified, it takes precedence. If this value is used as the name, it uses the</span>
<span class='doccomment'>/// same `[]` and `&lt;&gt;` requirement specification rules. If it is *not* used as the name, it </span>
<span class='doccomment'>/// still needs to be surrounded by either `[]` or `&lt;&gt;` but there is no requirement effect, </span>
<span class='doccomment'>/// as the requirement rule is determined by the real name. This value may follow the `short` </span>
<span class='doccomment'>/// or `long`, it doesn&#39;t matter. If it follows the `long`, it may follow either a `=` or ` `</span>
<span class='doccomment'>/// there is no difference, just personal preference. If this follows a `short` it can only</span>
<span class='doccomment'>/// be after a ` `) i.e. `-c [name]`, `--config [name]`, `--config=[name]`, etc.</span>
<span class='doccomment'>/// 5. Multiple specifier `...` (the `...` may follow the name, `short`, `long`, or value *without*</span>
<span class='doccomment'>/// a ` ` space) i.e. `&lt;name&gt;... -c`, `--config &lt;name&gt;...`, `[name] -c...`, etc.</span>
<span class='doccomment'>/// 6. The help info surrounded by `&#39;`s (single quotes)</span>
<span class='doccomment'>/// 7. The index of a positional argument will be the next available index (you don&#39;t need to</span>
<span class='doccomment'>/// specify one)</span>
<span class='doccomment'>/// specify one) i.e. all arguments without a `short` or `long` will be treated as positional</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// </span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>/// # Example</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .args(vec![</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// // A option argument with a long, named &quot;conf&quot; (note: because the name was specified</span>
<span class='doccomment'>/// // the portion after the long can be called anything, only the first name will be displayed</span>
<span class='doccomment'>/// // to the user. Also, requirement is set with the *name*, so the portion after the long could</span>
@ -740,8 +777,10 @@
<span class='doccomment'>/// // omitted, the name would have been derived from the portion after the long and those rules</span>
<span class='doccomment'>/// // would have mattered)</span>
<span class='doccomment'>/// Arg::from_usage(&quot;[conf] --config=[c] &#39;a required file for the configuration&#39;&quot;),</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// // A flag with a short, a long, named &quot;debug&quot;, and accepts multiple values</span>
<span class='doccomment'>/// Arg::from_usage(&quot;-d --debug... &#39;turns on debugging information&quot;),</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// // A required positional argument named &quot;input&quot;</span>
<span class='doccomment'>/// Arg::from_usage(&quot;&lt;input&gt; &#39;the input file to use&#39;&quot;)</span>
<span class='doccomment'>/// ])</span>
@ -819,9 +858,10 @@
<span class='doccomment'>/// will not asign those to the displaying of version or help.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// **NOTE:** Any leading `-` characters will be stripped, and only the first</span>
<span class='doccomment'>/// non `-` chacter will be used as the `short` version, i.e. for when the user</span>
<span class='doccomment'>/// mistakenly sets the short to `-o` or the like.</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>/// non `-` chacter will be used as the `short` version</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, Arg};</span>
@ -842,10 +882,10 @@
<span class='doccomment'>/// will not asign those to the displaying of version or help automatically, and you will have to do</span>
<span class='doccomment'>/// so manually.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// **NOTE:** Any leading `-` characters will be stripped i.e. for </span>
<span class='doccomment'>/// when the user mistakenly sets the short to `--out` or the like.</span>
<span class='doccomment'>/// **NOTE:** Any leading `-` characters will be stripped</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
@ -862,7 +902,8 @@
<span class='doccomment'>/// Sets the help text of the argument that will be displayed to the user</span>
<span class='doccomment'>/// when they print the usage/help information. </span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
@ -885,13 +926,14 @@
<span class='doccomment'>/// cannot be required by default.</span>
<span class='doccomment'>/// when they print the usage/help information. </span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// # Arg::with_name(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .required(true)</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>required</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>r</span>: <span class='ident'>bool</span>) <span class='op'>-&gt;</span> <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;n</span>, <span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;p</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span> {
@ -906,11 +948,12 @@
<span class='doccomment'>/// by default. Mutually exclusive rules only need to be set for one of the two</span>
<span class='doccomment'>/// arguments, they do not need to be set for each.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::with_name(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .mutually_excludes(&quot;debug&quot;)</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>mutually_excludes</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>name</span>: <span class='kw-2'>&amp;</span><span class='lifetime'>&#39;b</span> <span class='ident'>str</span>) <span class='op'>-&gt;</span> <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;n</span>, <span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;p</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span> {
@ -929,11 +972,12 @@
<span class='doccomment'>/// by default. Mutually exclusive rules only need to be set for one of the two</span>
<span class='doccomment'>/// arguments, they do not need to be set for each.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::with_name(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .mutually_excludes_all(</span>
<span class='doccomment'>/// vec![&quot;debug&quot;, &quot;input&quot;])</span>
<span class='doccomment'>/// # ).get_matches();</span>
@ -953,11 +997,12 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// **NOTE:** Mutually exclusive rules take precedence over being required</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::with_name(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .requires(&quot;debug&quot;)</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>requires</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>name</span>: <span class='kw-2'>&amp;</span><span class='lifetime'>&#39;r</span> <span class='ident'>str</span>) <span class='op'>-&gt;</span> <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;n</span>, <span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;p</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span> {
@ -975,11 +1020,12 @@
<span class='doccomment'>/// **NOTE:** Mutually exclusive rules take precedence over being required</span>
<span class='doccomment'>/// by default. </span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::with_name(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .requires_all(</span>
<span class='doccomment'>/// vec![&quot;debug&quot;, &quot;input&quot;])</span>
<span class='doccomment'>/// # ).get_matches();</span>
@ -999,13 +1045,14 @@
<span class='doccomment'>/// **NOTE:** When setting this to `true` the `name` of the argument</span>
<span class='doccomment'>/// will be used when printing the help/usage information to the user. </span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// # Arg::with_name(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .takes_value(true)</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>takes_value</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>tv</span>: <span class='ident'>bool</span>) <span class='op'>-&gt;</span> <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;n</span>, <span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;p</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span> {
@ -1020,13 +1067,14 @@
<span class='doccomment'>/// Also, the name will be used when printing the help/usage information </span>
<span class='doccomment'>/// to the user. </span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// # Arg::with_name(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .index(1)</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>index</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>idx</span>: <span class='ident'>u8</span>) <span class='op'>-&gt;</span> <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;n</span>, <span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;p</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span> {
@ -1042,13 +1090,14 @@
<span class='doccomment'>/// **NOTE:** When setting this, any `takes_value` or `index` values you set</span>
<span class='doccomment'>/// are ignored as flags cannot have a values or an `index`.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;debug&quot;)</span>
<span class='doccomment'>/// # Arg::with_name(&quot;debug&quot;)</span>
<span class='doccomment'>/// .multiple(true)</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>multiple</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>multi</span>: <span class='ident'>bool</span>) <span class='op'>-&gt;</span> <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;n</span>, <span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;p</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span> {
@ -1061,13 +1110,14 @@
<span class='doccomment'>/// </span>
<span class='doccomment'>/// **NOTE:** This setting only applies to options and positional arguments </span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</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, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;debug&quot;).index(1)</span>
<span class='doccomment'>/// # Arg::with_name(&quot;debug&quot;).index(1)</span>
<span class='doccomment'>/// .possible_values(vec![&quot;fast&quot;, &quot;slow&quot;])</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>possible_values</span>(<span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>names</span>: <span class='ident'>Vec</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;p</span> <span class='ident'>str</span><span class='op'>&gt;</span>) <span class='op'>-&gt;</span> <span class='ident'>Arg</span><span class='op'>&lt;</span><span class='lifetime'>&#39;n</span>, <span class='lifetime'>&#39;l</span>, <span class='lifetime'>&#39;h</span>, <span class='lifetime'>&#39;b</span>, <span class='lifetime'>&#39;p</span>, <span class='lifetime'>&#39;r</span><span class='op'>&gt;</span> {