mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 06:42:33 +00:00
chore(docs): rebuild documentation
This commit is contained in:
parent
b389743672
commit
3c217b22b9
12 changed files with 314 additions and 177 deletions
|
@ -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."]]});
|
|
@ -360,8 +360,8 @@ SUBCOMMANDS:
|
||||||
<tr>
|
<tr>
|
||||||
<td><a class='stability Unmarked' title='No stability level'></a><a class='struct' href='struct.App.html'
|
<td><a class='stability Unmarked' title='No stability level'></a><a class='struct' href='struct.App.html'
|
||||||
title='clap::App'>App</a></td>
|
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
|
<td class='docblock short'><p>Used to create a representation of a command line program and all possible command line
|
||||||
for parsing at runtime.</p>
|
arguments for parsing at runtime.</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
|
@ -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."]]});
|
|
@ -43,14 +43,18 @@
|
||||||
<section id='main' class="content struct">
|
<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'>
|
<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>
|
<a id="collapse-all" href="#">[-]</a> <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<'a, 'v, 'ab, 'u, 'ar> {
|
<pre class='rust struct'>pub struct App<'a, 'v, 'ab, 'u, 'ar> {
|
||||||
// some fields omitted
|
// some fields omitted
|
||||||
}</pre><div class='docblock'><p>Used to create a representation of the program and all possible command line arguments
|
}</pre><div class='docblock'><p>Used to create a representation of a command line program and all possible command line
|
||||||
for parsing at runtime.</p>
|
arguments for parsing at runtime.</p>
|
||||||
|
|
||||||
<p>Stores a list of all posisble arguments, as well as information displayed to the user such as
|
<p>Application settings are set using the "builder pattern" with <code>.get_matches()</code> being the
|
||||||
help and versioning information.</p>
|
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
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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'>"1.0.2"</span>)
|
.<span class='ident'>version</span>(<span class='string'>"1.0.2"</span>)
|
||||||
.<span class='ident'>about</span>(<span class='string'>"Explains in brief what the program does"</span>)
|
.<span class='ident'>about</span>(<span class='string'>"Explains in brief what the program does"</span>)
|
||||||
.<span class='ident'>arg</span>(
|
.<span class='ident'>arg</span>(
|
||||||
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>"in_file"</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'>"in_file"</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='comment'>// Add other possible command line argument options here...</span>
|
||||||
)
|
)
|
||||||
.<span class='ident'>get_matches</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>
|
<span class='comment'>// Your pogram logic starts here...</span>
|
||||||
</pre>
|
</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, 'ar> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, '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>(n: &'n <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, 'ar></code></h4>
|
</div><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl<'a, 'v, 'ab, 'u, 'ar> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, '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>(n: &'n <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, 'ar></code></h4>
|
||||||
<div class='docblock'><p>Creates a new instance of an application requiring a name (such as the binary). Will be displayed
|
<div class='docblock'><p>Creates a new instance of an application requiring a name (such as the binary). The name
|
||||||
to the user when they print version or help and usage information.</p>
|
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>
|
||||||
|
|
||||||
<h1 id="example" class='section-header'><a
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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>)
|
<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>
|
</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, 'ar></code></h4>
|
</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, 'ar></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
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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'>"v0.1.24"</span>)
|
.<span class='ident'>version</span>(<span class='string'>"v0.1.24"</span>)
|
||||||
</pre>
|
</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, 'ar></code></h4>
|
</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, 'ar></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
|
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 "USAGE: \n\t" portion, as that will
|
<p><em>NOTE:</em> You do not need to specify the "USAGE: \n\t" portion, as that will
|
||||||
still be applied by <code>clap</code>, you only need to specify the portion starting
|
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'>"myapp [-clDas] <some_file>"</span>)
|
.<span class='ident'>usage</span>(<span class='string'>"myapp [-clDas] <some_file>"</span>)
|
||||||
</pre>
|
</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><'l, 'h, 'b, 'r>(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, 'ar></code></h4>
|
</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><'l, 'h, 'b, 'r>(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, 'ar></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'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
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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'>"config"</span>)
|
<span class='comment'>// Adding a single "flag" argument with a short and help text, using Arg::with_name()</span>
|
||||||
.<span class='ident'>short</span>(<span class='string'>"c"</span>)
|
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>"debug"</span>)
|
||||||
<span class='comment'>// Additional argument configuration goes here...</span>
|
.<span class='ident'>short</span>(<span class='string'>"d"</span>)
|
||||||
)
|
.<span class='ident'>help</span>(<span class='string'>"turns on debugging mode"</span>))
|
||||||
|
<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>
|
</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, 'ar></code></h4>
|
</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, 'ar></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
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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'>"config"</span>).<span class='ident'>short</span>(<span class='string'>"c"</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'>"[debug] -d 'turns on debugging info"</span>),
|
||||||
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>"debug"</span>).<span class='ident'>short</span>(<span class='string'>"d"</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>
|
</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, 'ar></code></h4>
|
</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, 'ar></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
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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>)
|
.<span class='ident'>arg_from_usage</span>(<span class='string'>"-c --conf=<config> 'Sets a configuration file to use'"</span>)
|
||||||
</pre>
|
</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, 'ar></code></h4>
|
</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, 'ar></code></h4>
|
||||||
<div class='docblock'><p>Adds multiple arguments from a usage string, one per line. See Arg::from_usage() for
|
<div class='docblock'><p>Adds multiple arguments at once from a usage string, one per line. See <code>Arg::from_usage()</code>
|
||||||
details</p>
|
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't need any of the more advanced configuration options.</p>
|
||||||
|
|
||||||
<h1 id="example" class='section-header'><a
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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><'a, 'v, 'ab, 'u, 'ar>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'ar></code></h4>
|
</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, 'ar>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'ar></code></h4>
|
||||||
<div class='docblock'><p>Adds a subcommand to the list of valid possibilties. Subcommands are effectively sub apps,
|
<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
|
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
|
function just like apps, in that they get their own auto generated help, version, and usage.</p>
|
||||||
switches.</p>
|
|
||||||
|
|
||||||
<h1 id="example" class='section-header'><a
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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'>"config"</span>)
|
.<span class='ident'>subcommand</span>(<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>"config"</span>)
|
||||||
.<span class='ident'>about</span>(<span class='string'>"Controls configuration features"</span>)
|
.<span class='ident'>about</span>(<span class='string'>"Controls configuration features"</span>)
|
||||||
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>"config_file"</span>)
|
.<span class='ident'>arg_from_usage</span>(<span class='string'>"<config> 'Required configuration file to use'"</span>)))
|
||||||
.<span class='ident'>index</span>(<span class='number'>1</span>)
|
<span class='comment'>// Additional subcommand configuration goes here, such as other arguments...</span>
|
||||||
.<span class='ident'>help</span>(<span class='string'>"Configuration file to use"</span>)))
|
|
||||||
<span class='comment'>// Additional subcommand configuration goes here, such as arguments...</span>
|
|
||||||
</pre>
|
</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, 'ar>>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'ar></code></h4>
|
</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, 'ar>>) -> <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a><'a, 'v, 'ab, 'u, 'ar></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
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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'>subcommands</span>( <span class='macro'>vec</span><span class='macro'>!</span>[
|
||||||
<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>"config"</span>).<span class='ident'>about</span>(<span class='string'>"Controls configuration functionality"</span>)
|
<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>"config"</span>).<span class='ident'>about</span>(<span class='string'>"Controls configuration functionality"</span>)
|
||||||
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>"config_file"</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'>"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>)])
|
<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>
|
</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></code></h4>
|
</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></code></h4>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<section id='main' class="content struct">
|
<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'>
|
<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>
|
<a id="collapse-all" href="#">[-]</a> <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<'n, 'l, 'h, 'b, 'p, 'r> {
|
<pre class='rust struct'>pub struct Arg<'n, 'l, 'h, 'b, 'p, 'r> {
|
||||||
// some fields omitted
|
// some fields omitted
|
||||||
}</pre><div class='docblock'><p>The abstract representation of a command line argument used by the consumer of the library.
|
}</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
|
their program. Then evaluates the settings the consumer provided and determines the concret
|
||||||
argument type to use when parsing.</p>
|
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
|
<h1 id="example" class='section-header'><a
|
||||||
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
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>)
|
<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'>"conifg"</span>)
|
||||||
.<span class='ident'>short</span>(<span class='string'>"c"</span>)
|
.<span class='ident'>short</span>(<span class='string'>"c"</span>)
|
||||||
.<span class='ident'>long</span>(<span class='string'>"config"</span>)
|
.<span class='ident'>long</span>(<span class='string'>"config"</span>)
|
||||||
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>)
|
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>)
|
||||||
.<span class='ident'>help</span>(<span class='string'>"Provides a config file to myprog"</span>)
|
.<span class='ident'>help</span>(<span class='string'>"Provides a config file to myprog"</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'>"-i --input=[input] 'Provides an input file to the program'"</span>)
|
||||||
</pre>
|
</pre>
|
||||||
</div><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl<'n, 'l, 'h, 'b, 'p, 'r> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'b, '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, 'b, 'p, 'r></code></h4>
|
</div><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl<'n, 'l, 'h, 'b, 'p, 'r> <a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a><'n, 'l, 'h, 'b, '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, 'b, 'p, 'r></code></h4>
|
||||||
<div class='docblock'><p>Creates a new instace of <code>Arg</code> using a unique string name.
|
<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
|
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>
|
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>
|
Rust APIs</p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
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>)
|
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>"conifg"</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></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
|
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>
|
be displayed when the user prints the usage/help information of the program.</p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
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>)
|
<span class='ident'>Arg</span>::<span class='ident'>with_name</span>(<span class='string'>"conifg"</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></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
|
for Arg (i.e. everything except relational rules). The syntax is flexible, but there are
|
||||||
some rules to follow.</p>
|
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>
|
<ol>
|
||||||
<li>Name (arguments with a <code>long</code> or that take a value can ommit this if desired),
|
<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><></code> for required arguments.</li>
|
use <code>[]</code> for non-required arguments, or <code><></code> for required arguments.</li>
|
||||||
<li>Short preceded by a <code>-</code></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
|
<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>
|
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
|
<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
|
is manually specified, it takes precedence. If this value is used as the name, it uses the
|
||||||
same <code>[]</code> and <code><></code> requirement rules. If it is <em>not</em> used as the name, it still needs to
|
same <code>[]</code> and <code><></code> requirement specification rules. If it is <em>not</em> used as the name, it
|
||||||
be surrounded by either <code>[]</code> or <code><></code> but the effect is the same, as the requirement rule
|
still needs to be surrounded by either <code>[]</code> or <code><></code> but there is no requirement effect,
|
||||||
is determined by the name. The value may follow the <code>short</code> or <code>long</code>. If it
|
as the requirement rule is determined by the real name. This value may follow the <code>short</code>
|
||||||
follows the <code>long</code>, it may follow either a <code>=</code> or <code></code> with the same effect, personal
|
or <code>long</code>, it doesn't matter. If it follows the <code>long</code>, it may follow either a <code>=</code> or <code></code>
|
||||||
preference only, but may only follow a <code></code> after a <code>short</code>)</li>
|
there is no difference, just personal preference. If this follows a <code>short</code> it can only
|
||||||
<li>Multiple specifier <code>...</code> (for flags or positional arguments the <code>...</code> may follow the
|
be after a <code></code>) i.e. <code>-c [name]</code>, <code>--config [name]</code>, <code>--config=[name]</code>, etc.</li>
|
||||||
name or <code>short</code> or <code>long</code>)</li>
|
<li>Multiple specifier <code>...</code> (the <code>...</code> may follow the name, <code>short</code>, <code>long</code>, or value <em>without</em>
|
||||||
<li>The help info surrounded by <code>'</code></li>
|
a <code></code> space) i.e. <code><name>... -c</code>, <code>--config <name>...</code>, <code>[name] -c...</code>, etc.</li>
|
||||||
|
<li>The help info surrounded by <code>'</code>s (single quotes)</li>
|
||||||
<li>The index of a positional argument will be the next available index (you don't need to
|
<li>The index of a positional argument will be the next available index (you don'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>
|
</ol>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
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'>args</span>(<span class='macro'>vec</span><span class='macro'>!</span>[
|
||||||
|
|
||||||
<span class='comment'>// A option argument with a long, named "conf" (note: because the name was specified</span>
|
<span class='comment'>// A option argument with a long, named "conf" (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'>// 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>
|
<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'>// 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='comment'>// would have mattered)</span>
|
||||||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"[conf] --config=[c] 'a required file for the configuration'"</span>),
|
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"[conf] --config=[c] 'a required file for the configuration'"</span>),
|
||||||
|
|
||||||
<span class='comment'>// A flag with a short, a long, named "debug", and accepts multiple values</span>
|
<span class='comment'>// A flag with a short, a long, named "debug", and accepts multiple values</span>
|
||||||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"-d --debug... 'turns on debugging information"</span>),
|
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"-d --debug... 'turns on debugging information"</span>),
|
||||||
|
|
||||||
<span class='comment'>// A required positional argument named "input"</span>
|
<span class='comment'>// A required positional argument named "input"</span>
|
||||||
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"<input> 'the input file to use'"</span>)
|
<span class='ident'>Arg</span>::<span class='ident'>from_usage</span>(<span class='string'>"<input> 'the input file to use'"</span>)
|
||||||
])
|
])
|
||||||
|
<span class='attribute'>#
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></code></h4>
|
||||||
<div class='docblock'><p>Sets the short version of the argument without the preceding <code>-</code>.</p>
|
<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>
|
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
|
<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
|
non <code>-</code> chacter will be used as the <code>short</code> version</p>
|
||||||
mistakenly sets the short to <code>-o</code> or the like.
|
|
||||||
Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>short</span>(<span class='string'>"c"</span>)
|
.<span class='ident'>short</span>(<span class='string'>"c"</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></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
|
will not asign those to the displaying of version or help automatically, and you will have to do
|
||||||
so manually.</p>
|
so manually.</p>
|
||||||
|
|
||||||
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped i.e. for
|
<p><strong>NOTE:</strong> Any leading <code>-</code> characters will be stripped</p>
|
||||||
when the user mistakenly sets the short to <code>--out</code> or the like.</p>
|
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>long</span>(<span class='string'>"config"</span>)
|
.<span class='ident'>long</span>(<span class='string'>"config"</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></code></h4>
|
||||||
<div class='docblock'><p>Sets the help text of the argument that will be displayed to the user
|
<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>
|
when they print the usage/help information. </p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
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>)
|
.<span class='ident'>help</span>(<span class='string'>"The config file used by the myprog"</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></code></h4>
|
||||||
|
@ -180,8 +191,8 @@ by default.</p>
|
||||||
cannot be required by default.
|
cannot be required by default.
|
||||||
when they print the usage/help information. </p>
|
when they print the usage/help information. </p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>required</span>(<span class='boolval'>true</span>)
|
.<span class='ident'>required</span>(<span class='boolval'>true</span>)
|
||||||
</pre>
|
</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: &'b <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, 'b, 'p, 'r></code></h4>
|
</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: &'b <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, 'b, 'p, 'r></code></h4>
|
||||||
|
@ -192,8 +203,8 @@ the following argument can't be present.</p>
|
||||||
by default. Mutually exclusive rules only need to be set for one of the two
|
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>
|
arguments, they do not need to be set for each.</p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>mutually_excludes</span>(<span class='string'>"debug"</span>)
|
.<span class='ident'>mutually_excludes</span>(<span class='string'>"debug"</span>)
|
||||||
</pre>
|
</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><&'b <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, 'b, 'p, 'r></code></h4>
|
</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><&'b <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, 'b, 'p, 'r></code></h4>
|
||||||
|
@ -204,8 +215,8 @@ the following argument can't be present.</p>
|
||||||
by default. Mutually exclusive rules only need to be set for one of the two
|
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>
|
arguments, they do not need to be set for each.</p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>mutually_excludes_all</span>(
|
.<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>])
|
<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"debug"</span>, <span class='string'>"input"</span>])
|
||||||
</pre>
|
</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><strong>NOTE:</strong> Mutually exclusive rules take precedence over being required</p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>requires</span>(<span class='string'>"debug"</span>)
|
.<span class='ident'>requires</span>(<span class='string'>"debug"</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></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
|
<p><strong>NOTE:</strong> Mutually exclusive rules take precedence over being required
|
||||||
by default. </p>
|
by default. </p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>requires_all</span>(
|
.<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>])
|
<span class='macro'>vec</span><span class='macro'>!</span>[<span class='string'>"debug"</span>, <span class='string'>"input"</span>])
|
||||||
</pre>
|
</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
|
<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>
|
will be used when printing the help/usage information to the user. </p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>)
|
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></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
|
Also, the name will be used when printing the help/usage information
|
||||||
to the user. </p>
|
to the user. </p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>index</span>(<span class='number'>1</span>)
|
.<span class='ident'>index</span>(<span class='number'>1</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></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
|
<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>
|
are ignored as flags cannot have a values or an <code>index</code>.</p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
|
||||||
.<span class='ident'>multiple</span>(<span class='boolval'>true</span>)
|
.<span class='ident'>multiple</span>(<span class='boolval'>true</span>)
|
||||||
</pre>
|
</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, 'b, 'p, 'r></code></h4>
|
</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, 'b, 'p, 'r></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><strong>NOTE:</strong> This setting only applies to options and positional arguments </p>
|
||||||
|
|
||||||
<p>Example:</p>
|
<h1 id="example" class='section-header'><a
|
||||||
<pre id='rust-example-rendered' class='rust '>
|
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>])
|
.<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>
|
</pre>
|
||||||
</div></div></section>
|
</div></div></section>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<section id='main' class="content struct">
|
<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'>
|
<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>
|
<a id="collapse-all" href="#">[-]</a> <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<'a> {
|
<pre class='rust struct'>pub struct ArgMatches<'a> {
|
||||||
// some fields omitted
|
// some fields omitted
|
||||||
}</pre><div class='docblock'><p>Used to get information about the arguments that where supplied to the program at runtime by
|
}</pre><div class='docblock'><p>Used to get information about the arguments that where supplied to the program at runtime by
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<section id='main' class="content struct">
|
<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'>
|
<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>
|
<a id="collapse-all" href="#">[-]</a> <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<'a> {
|
<pre class='rust struct'>pub struct SubCommand<'a> {
|
||||||
pub name: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a>,
|
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><'a>,
|
pub matches: <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a><'a>,
|
||||||
|
|
|
@ -468,8 +468,6 @@
|
||||||
if ($active.length) {
|
if ($active.length) {
|
||||||
document.location.href = $active.find('a').prop('href');
|
document.location.href = $active.find('a').prop('href');
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$active.removeClass('highlighted');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -715,13 +713,11 @@
|
||||||
if (crates[i] == window.currentCrate) {
|
if (crates[i] == window.currentCrate) {
|
||||||
klass += ' current';
|
klass += ' current';
|
||||||
}
|
}
|
||||||
if (rawSearchIndex[crates[i]].items[0]) {
|
|
||||||
var desc = rawSearchIndex[crates[i]].items[0][3];
|
var desc = rawSearchIndex[crates[i]].items[0][3];
|
||||||
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
|
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
|
||||||
'title': plainSummaryLine(desc),
|
'title': plainSummaryLine(desc),
|
||||||
'class': klass}).text(crates[i]));
|
'class': klass}).text(crates[i]));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
sidebar.append(div);
|
sidebar.append(div);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1343,6 +1343,36 @@
|
||||||
<span id="1301">1301</span>
|
<span id="1301">1301</span>
|
||||||
<span id="1302">1302</span>
|
<span id="1302">1302</span>
|
||||||
<span id="1303">1303</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 '>
|
</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'>BTreeMap</span>;
|
||||||
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>collections</span>::<span class='ident'>BTreeSet</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'>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='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'>/// Used to create a representation of a command line program and all possible command line</span>
|
||||||
<span class='doccomment'>/// for parsing at runtime.</span>
|
<span class='doccomment'>/// arguments for parsing at runtime.</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
|
<span class='doccomment'>/// Application settings are set using the "builder pattern" 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'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// # Example</span>
|
<span class='doccomment'>/// # Example</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
|
@ -1375,7 +1409,7 @@
|
||||||
<span class='doccomment'>/// .version("1.0.2")</span>
|
<span class='doccomment'>/// .version("1.0.2")</span>
|
||||||
<span class='doccomment'>/// .about("Explains in brief what the program does")</span>
|
<span class='doccomment'>/// .about("Explains in brief what the program does")</span>
|
||||||
<span class='doccomment'>/// .arg(</span>
|
<span class='doccomment'>/// .arg(</span>
|
||||||
<span class='doccomment'>/// Arg::new("in_file").index(1)</span>
|
<span class='doccomment'>/// Arg::with_name("in_file").index(1)</span>
|
||||||
<span class='doccomment'>/// // Add other possible command line argument options here...</span>
|
<span class='doccomment'>/// // Add other possible command line argument options here...</span>
|
||||||
<span class='doccomment'>/// )</span>
|
<span class='doccomment'>/// )</span>
|
||||||
<span class='doccomment'>/// .get_matches();</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'><</span><span class='kw-2'>&</span><span class='lifetime'>'v</span> <span class='ident'>str</span><span class='op'>></span>,
|
<span class='ident'>version</span>: <span class='prelude-ty'>Option</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'v</span> <span class='ident'>str</span><span class='op'>></span>,
|
||||||
<span class='comment'>// A brief explaination of the program that gets displayed to the user when shown help/usage information</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'><</span><span class='kw-2'>&</span><span class='lifetime'>'ab</span> <span class='ident'>str</span><span class='op'>></span>,
|
<span class='ident'>about</span>: <span class='prelude-ty'>Option</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'ab</span> <span class='ident'>str</span><span class='op'>></span>,
|
||||||
|
<span class='comment'>// A list of possible flags</span>
|
||||||
<span class='ident'>flags</span>: <span class='ident'>BTreeMap</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'ar</span> <span class='ident'>str</span>, <span class='ident'>FlagBuilder</span><span class='op'><</span><span class='lifetime'>'ar</span><span class='op'>>></span>,
|
<span class='ident'>flags</span>: <span class='ident'>BTreeMap</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'ar</span> <span class='ident'>str</span>, <span class='ident'>FlagBuilder</span><span class='op'><</span><span class='lifetime'>'ar</span><span class='op'>>></span>,
|
||||||
|
<span class='comment'>// A list of possible options</span>
|
||||||
<span class='ident'>opts</span>: <span class='ident'>BTreeMap</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'ar</span> <span class='ident'>str</span>, <span class='ident'>OptBuilder</span><span class='op'><</span><span class='lifetime'>'ar</span><span class='op'>>></span>,
|
<span class='ident'>opts</span>: <span class='ident'>BTreeMap</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'ar</span> <span class='ident'>str</span>, <span class='ident'>OptBuilder</span><span class='op'><</span><span class='lifetime'>'ar</span><span class='op'>>></span>,
|
||||||
|
<span class='comment'>// A list of positional arguments</span>
|
||||||
<span class='ident'>positionals_idx</span>: <span class='ident'>BTreeMap</span><span class='op'><</span><span class='ident'>u8</span>, <span class='ident'>PosBuilder</span><span class='op'><</span><span class='lifetime'>'ar</span><span class='op'>>></span>,
|
<span class='ident'>positionals_idx</span>: <span class='ident'>BTreeMap</span><span class='op'><</span><span class='ident'>u8</span>, <span class='ident'>PosBuilder</span><span class='op'><</span><span class='lifetime'>'ar</span><span class='op'>>></span>,
|
||||||
|
<span class='comment'>// A list of subcommands</span>
|
||||||
<span class='ident'>subcommands</span>: <span class='ident'>BTreeMap</span><span class='op'><</span><span class='ident'>String</span>, <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>>></span>,
|
<span class='ident'>subcommands</span>: <span class='ident'>BTreeMap</span><span class='op'><</span><span class='ident'>String</span>, <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>>></span>,
|
||||||
<span class='ident'>needs_long_help</span>: <span class='ident'>bool</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>,
|
<span class='ident'>needs_long_version</span>: <span class='ident'>bool</span>,
|
||||||
|
@ -1412,8 +1450,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class='kw'>impl</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span>{
|
<span class='kw'>impl</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></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'>/// Creates a new instance of an application requiring a name (such as the binary). The name</span>
|
||||||
<span class='doccomment'>/// to the user when they print version or help and usage information.</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 '-' are ok).</span>
|
||||||
|
<span class='doccomment'>///</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'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// # Example</span>
|
<span class='doccomment'>/// # Example</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
|
@ -1495,9 +1536,9 @@
|
||||||
<span class='self'>self</span>
|
<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'>/// 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'>/// </span>
|
||||||
<span class='doccomment'>/// *NOTE:* You do not need to specify the "USAGE: \n\t" portion, as that will </span>
|
<span class='doccomment'>/// *NOTE:* You do not need to specify the "USAGE: \n\t" portion, as that will </span>
|
||||||
<span class='doccomment'>/// still be applied by `clap`, you only need to specify the portion starting</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'>/// *NOTE:* This will not replace the entire help message, *only* the portion</span>
|
||||||
<span class='doccomment'>/// showing the usage.</span>
|
<span class='doccomment'>/// showing the usage.</span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
|
@ -1519,17 +1561,26 @@
|
||||||
<span class='self'>self</span>
|
<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'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'>///</span>
|
||||||
<span class='doccomment'>/// # Example</span>
|
<span class='doccomment'>/// # Example</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let app = App::new("myprog")</span>
|
<span class='doccomment'>/// # let app = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// .arg(Arg::new("config")</span>
|
<span class='doccomment'>/// // Adding a single "flag" argument with a short and help text, using Arg::with_name()</span>
|
||||||
<span class='doccomment'>/// .short("c")</span>
|
<span class='doccomment'>/// .arg(Arg::with_name("debug")</span>
|
||||||
<span class='doccomment'>/// // Additional argument configuration goes here...</span>
|
<span class='doccomment'>/// .short("d")</span>
|
||||||
<span class='doccomment'>/// )</span>
|
<span class='doccomment'>/// .help("turns on debugging mode"))</span>
|
||||||
|
<span class='doccomment'>/// // Adding a single "option" argument with a short, a long, and help text using the less verbose Arg::from_usage()</span>
|
||||||
|
<span class='doccomment'>/// .arg(Arg::from_usage("-c --config=[CONFIG] 'Optionally sets a configuration file to use'"))</span>
|
||||||
<span class='doccomment'>/// # .get_matches();</span>
|
<span class='doccomment'>/// # .get_matches();</span>
|
||||||
<span class='doccomment'>/// ```</span>
|
<span class='doccomment'>/// ```</span>
|
||||||
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>arg</span><span class='op'><</span><span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'r</span><span class='op'>></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'><</span><span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span><span class='op'>></span>) <span class='op'>-></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span> {
|
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>arg</span><span class='op'><</span><span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'r</span><span class='op'>></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'><</span><span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span><span class='op'>></span>) <span class='op'>-></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span> {
|
||||||
|
@ -1693,15 +1744,16 @@
|
||||||
<span class='self'>self</span>
|
<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'>///</span>
|
||||||
<span class='doccomment'>/// # Example</span>
|
<span class='doccomment'>/// # Example</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let app = App::new("myprog")</span>
|
<span class='doccomment'>/// # let app = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// .args( vec![Arg::new("config").short("c"),</span>
|
<span class='doccomment'>/// .args( vec![Arg::from_usage("[debug] -d 'turns on debugging info"),</span>
|
||||||
<span class='doccomment'>/// Arg::new("debug").short("d")])</span>
|
<span class='doccomment'>/// Arg::with_name("input").index(1).help("the input file to use")])</span>
|
||||||
<span class='doccomment'>/// # .get_matches();</span>
|
<span class='doccomment'>/// # .get_matches();</span>
|
||||||
<span class='doccomment'>/// ```</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'><</span><span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span><span class='op'>>></span>) <span class='op'>-></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></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'><</span><span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span>, <span class='lifetime'>'ar</span><span class='op'>>></span>) <span class='op'>-></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span> {
|
||||||
|
@ -1711,7 +1763,12 @@
|
||||||
<span class='self'>self</span>
|
<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'>///</span>
|
||||||
<span class='doccomment'>/// # Example</span>
|
<span class='doccomment'>/// # Example</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
|
@ -1726,8 +1783,13 @@
|
||||||
<span class='self'>self</span>
|
<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'>/// Adds multiple arguments at once from a usage string, one per line. See `Arg::from_usage()`</span>
|
||||||
<span class='doccomment'>/// details</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't need any of the more advanced configuration options.</span>
|
||||||
|
<span class='doccomment'>///</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'>///</span>
|
||||||
|
@ -1742,7 +1804,7 @@
|
||||||
<span class='doccomment'>/// ```</span>
|
<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'>&</span><span class='lifetime'>'ar</span> <span class='ident'>str</span>) <span class='op'>-></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></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'>&</span><span class='lifetime'>'ar</span> <span class='ident'>str</span>) <span class='op'>-></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></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='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>
|
<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'>/// 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'>/// 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'>/// function just like apps, in that they get their own auto generated help, version, and usage.</span>
|
||||||
<span class='doccomment'>/// switches.</span>
|
<span class='doccomment'>///</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'>///</span>
|
||||||
|
@ -1760,10 +1822,8 @@
|
||||||
<span class='doccomment'>/// # let app = App::new("myprog")</span>
|
<span class='doccomment'>/// # let app = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// .subcommand(SubCommand::new("config")</span>
|
<span class='doccomment'>/// .subcommand(SubCommand::new("config")</span>
|
||||||
<span class='doccomment'>/// .about("Controls configuration features")</span>
|
<span class='doccomment'>/// .about("Controls configuration features")</span>
|
||||||
<span class='doccomment'>/// .arg(Arg::new("config_file")</span>
|
<span class='doccomment'>/// .arg_from_usage("<config> 'Required configuration file to use'")))</span>
|
||||||
<span class='doccomment'>/// .index(1)</span>
|
<span class='doccomment'>/// // Additional subcommand configuration goes here, such as other arguments...</span>
|
||||||
<span class='doccomment'>/// .help("Configuration file to use")))</span>
|
|
||||||
<span class='doccomment'>/// // Additional subcommand configuration goes here, such as arguments...</span>
|
|
||||||
<span class='doccomment'>/// # .get_matches();</span>
|
<span class='doccomment'>/// # .get_matches();</span>
|
||||||
<span class='doccomment'>/// ```</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'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span>) <span class='op'>-></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></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'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span>) <span class='op'>-></span> <span class='ident'>App</span><span class='op'><</span><span class='lifetime'>'a</span>, <span class='lifetime'>'v</span>, <span class='lifetime'>'ab</span>, <span class='lifetime'>'u</span>, <span class='lifetime'>'ar</span><span class='op'>></span> {
|
||||||
|
@ -1772,7 +1832,7 @@
|
||||||
<span class='self'>self</span>
|
<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'>///</span>
|
||||||
<span class='doccomment'>/// # Example</span>
|
<span class='doccomment'>/// # Example</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
|
@ -1781,7 +1841,7 @@
|
||||||
<span class='doccomment'>/// # let app = App::new("myprog")</span>
|
<span class='doccomment'>/// # let app = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// .subcommands( vec![</span>
|
<span class='doccomment'>/// .subcommands( vec![</span>
|
||||||
<span class='doccomment'>/// SubCommand::new("config").about("Controls configuration functionality")</span>
|
<span class='doccomment'>/// SubCommand::new("config").about("Controls configuration functionality")</span>
|
||||||
<span class='doccomment'>/// .arg(Arg::new("config_file").index(1)),</span>
|
<span class='doccomment'>/// .arg(Arg::with_name("config_file").index(1)),</span>
|
||||||
<span class='doccomment'>/// SubCommand::new("debug").about("Controls debug functionality")])</span>
|
<span class='doccomment'>/// SubCommand::new("debug").about("Controls debug functionality")])</span>
|
||||||
<span class='doccomment'>/// # .get_matches();</span>
|
<span class='doccomment'>/// # .get_matches();</span>
|
||||||
<span class='doccomment'>/// ```</span>
|
<span class='doccomment'>/// ```</span>
|
||||||
|
|
|
@ -560,28 +560,61 @@
|
||||||
<span id="518">518</span>
|
<span id="518">518</span>
|
||||||
<span id="519">519</span>
|
<span id="519">519</span>
|
||||||
<span id="520">520</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 '>
|
</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='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'>/// 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'>/// 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'>///</span>
|
|
||||||
<span class='doccomment'>/// This struct is used by the library consumer and describes the command line arguments for </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'>/// 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'>/// argument type to use when parsing.</span>
|
||||||
<span class='doccomment'>///</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'>/// # Example</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// # .arg(</span>
|
<span class='doccomment'>/// # .arg(</span>
|
||||||
<span class='doccomment'>/// Arg::new("conifg")</span>
|
<span class='doccomment'>/// // Using the traditional builder pattern and setting each option manually</span>
|
||||||
|
<span class='doccomment'>/// Arg::with_name("conifg")</span>
|
||||||
<span class='doccomment'>/// .short("c")</span>
|
<span class='doccomment'>/// .short("c")</span>
|
||||||
<span class='doccomment'>/// .long("config")</span>
|
<span class='doccomment'>/// .long("config")</span>
|
||||||
<span class='doccomment'>/// .takes_value(true)</span>
|
<span class='doccomment'>/// .takes_value(true)</span>
|
||||||
<span class='doccomment'>/// .help("Provides a config file to myprog")</span>
|
<span class='doccomment'>/// .help("Provides a config file to myprog")</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("-i --input=[input] 'Provides an input file to the program'")</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></span> {
|
<span class='kw'>pub</span> <span class='kw'>struct</span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></span> {
|
||||||
<span class='doccomment'>/// The unique name of the argument, required</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'>/// 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'>/// be displayed when the user prints the usage/help information of the program.</span>
|
||||||
<span class='doccomment'>///</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'>/// Rust APIs</span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</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'>/// 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'>/// be displayed when the user prints the usage/help information of the program.</span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</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'>/// 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'>/// some rules to follow.</span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// 1. Name (arguments with a `long` or that take a value can ommit this if desired),</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 `<>` for required arguments.</span>
|
<span class='doccomment'>/// use `[]` for non-required arguments, or `<>` for required arguments.</span>
|
||||||
<span class='doccomment'>/// 2. Short preceded by a `-`</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'>/// 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'>/// 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'>/// 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'>/// is manually specified, it takes precedence. If this value is used as the name, it uses the</span>
|
||||||
<span class='doccomment'>/// same `[]` and `<>` requirement rules. If it is *not* used as the name, it still needs to</span>
|
<span class='doccomment'>/// same `[]` and `<>` requirement specification rules. If it is *not* used as the name, it </span>
|
||||||
<span class='doccomment'>/// be surrounded by either `[]` or `<>` but the effect is the same, as the requirement rule</span>
|
<span class='doccomment'>/// still needs to be surrounded by either `[]` or `<>` but there is no requirement effect, </span>
|
||||||
<span class='doccomment'>/// is determined by the name. The value may follow the `short` or `long`. If it</span>
|
<span class='doccomment'>/// as the requirement rule is determined by the real name. This value may follow the `short` </span>
|
||||||
<span class='doccomment'>/// follows the `long`, it may follow either a `=` or ` ` with the same effect, personal</span>
|
<span class='doccomment'>/// or `long`, it doesn't matter. If it follows the `long`, it may follow either a `=` or ` `</span>
|
||||||
<span class='doccomment'>/// preference only, but may only follow a ` ` after a `short`)</span>
|
<span class='doccomment'>/// there is no difference, just personal preference. If this follows a `short` it can only</span>
|
||||||
<span class='doccomment'>/// 5. Multiple specifier `...` (for flags or positional arguments the `...` may follow the</span>
|
<span class='doccomment'>/// be after a ` `) i.e. `-c [name]`, `--config [name]`, `--config=[name]`, etc.</span>
|
||||||
<span class='doccomment'>/// name or `short` or `long`)</span>
|
<span class='doccomment'>/// 5. Multiple specifier `...` (the `...` may follow the name, `short`, `long`, or value *without*</span>
|
||||||
<span class='doccomment'>/// 6. The help info surrounded by `'`</span>
|
<span class='doccomment'>/// a ` ` space) i.e. `<name>... -c`, `--config <name>...`, `[name] -c...`, etc.</span>
|
||||||
|
<span class='doccomment'>/// 6. The help info surrounded by `'`s (single quotes)</span>
|
||||||
<span class='doccomment'>/// 7. The index of a positional argument will be the next available index (you don't need to</span>
|
<span class='doccomment'>/// 7. The index of a positional argument will be the next available index (you don'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'>/// </span>
|
<span class='doccomment'>/// </span>
|
||||||
<span class='doccomment'>/// Example:</span>
|
<span class='doccomment'>/// # Example</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// .args(vec![</span>
|
<span class='doccomment'>/// .args(vec![</span>
|
||||||
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// // A option argument with a long, named "conf" (note: because the name was specified</span>
|
<span class='doccomment'>/// // A option argument with a long, named "conf" (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'>/// // 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>
|
<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'>/// // 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'>/// // would have mattered)</span>
|
||||||
<span class='doccomment'>/// Arg::from_usage("[conf] --config=[c] 'a required file for the configuration'"),</span>
|
<span class='doccomment'>/// Arg::from_usage("[conf] --config=[c] 'a required file for the configuration'"),</span>
|
||||||
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// // A flag with a short, a long, named "debug", and accepts multiple values</span>
|
<span class='doccomment'>/// // A flag with a short, a long, named "debug", and accepts multiple values</span>
|
||||||
<span class='doccomment'>/// Arg::from_usage("-d --debug... 'turns on debugging information"),</span>
|
<span class='doccomment'>/// Arg::from_usage("-d --debug... 'turns on debugging information"),</span>
|
||||||
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// // A required positional argument named "input"</span>
|
<span class='doccomment'>/// // A required positional argument named "input"</span>
|
||||||
<span class='doccomment'>/// Arg::from_usage("<input> 'the input file to use'")</span>
|
<span class='doccomment'>/// Arg::from_usage("<input> 'the input file to use'")</span>
|
||||||
<span class='doccomment'>/// ])</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'>/// will not asign those to the displaying of version or help.</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// **NOTE:** Any leading `-` characters will be stripped, and only the first</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'>/// non `-` chacter will be used as the `short` version</span>
|
||||||
<span class='doccomment'>/// mistakenly sets the short to `-o` or the like.</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</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'>/// 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'>/// so manually.</span>
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// **NOTE:** Any leading `-` characters will be stripped i.e. for </span>
|
<span class='doccomment'>/// **NOTE:** Any leading `-` characters will be stripped</span>
|
||||||
<span class='doccomment'>/// when the user mistakenly sets the short to `--out` or the like.</span>
|
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</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'>/// 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'>/// when they print the usage/help information. </span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</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'>/// cannot be required by default.</span>
|
||||||
<span class='doccomment'>/// when they print the usage/help information. </span>
|
<span class='doccomment'>/// when they print the usage/help information. </span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// # .arg(</span>
|
<span class='doccomment'>/// # .arg(</span>
|
||||||
<span class='doccomment'>/// # Arg::new("conifg")</span>
|
<span class='doccomment'>/// # Arg::with_name("conifg")</span>
|
||||||
<span class='doccomment'>/// .required(true)</span>
|
<span class='doccomment'>/// .required(true)</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'>/// 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'>/// arguments, they do not need to be set for each.</span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let myprog = App::new("myprog").arg(Arg::new("conifg")</span>
|
<span class='doccomment'>/// # let myprog = App::new("myprog").arg(Arg::with_name("conifg")</span>
|
||||||
<span class='doccomment'>/// .mutually_excludes("debug")</span>
|
<span class='doccomment'>/// .mutually_excludes("debug")</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'>&</span><span class='lifetime'>'b</span> <span class='ident'>str</span>) <span class='op'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'>&</span><span class='lifetime'>'b</span> <span class='ident'>str</span>) <span class='op'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'>/// 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'>/// arguments, they do not need to be set for each.</span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let myprog = App::new("myprog").arg(Arg::new("conifg")</span>
|
<span class='doccomment'>/// # let myprog = App::new("myprog").arg(Arg::with_name("conifg")</span>
|
||||||
<span class='doccomment'>/// .mutually_excludes_all(</span>
|
<span class='doccomment'>/// .mutually_excludes_all(</span>
|
||||||
<span class='doccomment'>/// vec!["debug", "input"])</span>
|
<span class='doccomment'>/// vec!["debug", "input"])</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</span>
|
<span class='doccomment'>/// # ).get_matches();</span>
|
||||||
|
@ -953,11 +997,12 @@
|
||||||
<span class='doccomment'>///</span>
|
<span class='doccomment'>///</span>
|
||||||
<span class='doccomment'>/// **NOTE:** Mutually exclusive rules take precedence over being required</span>
|
<span class='doccomment'>/// **NOTE:** Mutually exclusive rules take precedence over being required</span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let myprog = App::new("myprog").arg(Arg::new("conifg")</span>
|
<span class='doccomment'>/// # let myprog = App::new("myprog").arg(Arg::with_name("conifg")</span>
|
||||||
<span class='doccomment'>/// .requires("debug")</span>
|
<span class='doccomment'>/// .requires("debug")</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'>&</span><span class='lifetime'>'r</span> <span class='ident'>str</span>) <span class='op'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'>&</span><span class='lifetime'>'r</span> <span class='ident'>str</span>) <span class='op'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></span> {
|
||||||
|
@ -975,11 +1020,12 @@
|
||||||
<span class='doccomment'>/// **NOTE:** Mutually exclusive rules take precedence over being required</span>
|
<span class='doccomment'>/// **NOTE:** Mutually exclusive rules take precedence over being required</span>
|
||||||
<span class='doccomment'>/// by default. </span>
|
<span class='doccomment'>/// by default. </span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let myprog = App::new("myprog").arg(Arg::new("conifg")</span>
|
<span class='doccomment'>/// # let myprog = App::new("myprog").arg(Arg::with_name("conifg")</span>
|
||||||
<span class='doccomment'>/// .requires_all(</span>
|
<span class='doccomment'>/// .requires_all(</span>
|
||||||
<span class='doccomment'>/// vec!["debug", "input"])</span>
|
<span class='doccomment'>/// vec!["debug", "input"])</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'>/// **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'>/// will be used when printing the help/usage information to the user. </span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// # .arg(</span>
|
<span class='doccomment'>/// # .arg(</span>
|
||||||
<span class='doccomment'>/// # Arg::new("conifg")</span>
|
<span class='doccomment'>/// # Arg::with_name("conifg")</span>
|
||||||
<span class='doccomment'>/// .takes_value(true)</span>
|
<span class='doccomment'>/// .takes_value(true)</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></span> {
|
||||||
|
@ -1020,13 +1067,14 @@
|
||||||
<span class='doccomment'>/// Also, the name will be used when printing the help/usage information </span>
|
<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'>/// to the user. </span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// # .arg(</span>
|
<span class='doccomment'>/// # .arg(</span>
|
||||||
<span class='doccomment'>/// # Arg::new("conifg")</span>
|
<span class='doccomment'>/// # Arg::with_name("conifg")</span>
|
||||||
<span class='doccomment'>/// .index(1)</span>
|
<span class='doccomment'>/// .index(1)</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></span> {
|
||||||
|
@ -1042,13 +1090,14 @@
|
||||||
<span class='doccomment'>/// **NOTE:** When setting this, any `takes_value` or `index` values you set</span>
|
<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'>/// are ignored as flags cannot have a values or an `index`.</span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// # .arg(</span>
|
<span class='doccomment'>/// # .arg(</span>
|
||||||
<span class='doccomment'>/// # Arg::new("debug")</span>
|
<span class='doccomment'>/// # Arg::with_name("debug")</span>
|
||||||
<span class='doccomment'>/// .multiple(true)</span>
|
<span class='doccomment'>/// .multiple(true)</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></span> {
|
||||||
|
@ -1061,13 +1110,14 @@
|
||||||
<span class='doccomment'>/// </span>
|
<span class='doccomment'>/// </span>
|
||||||
<span class='doccomment'>/// **NOTE:** This setting only applies to options and positional arguments </span>
|
<span class='doccomment'>/// **NOTE:** This setting only applies to options and positional arguments </span>
|
||||||
<span class='doccomment'>///</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'>///</span>
|
||||||
<span class='doccomment'>/// ```no_run</span>
|
<span class='doccomment'>/// ```no_run</span>
|
||||||
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
<span class='doccomment'>/// # use clap::{App, Arg};</span>
|
||||||
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
<span class='doccomment'>/// # let matches = App::new("myprog")</span>
|
||||||
<span class='doccomment'>/// # .arg(</span>
|
<span class='doccomment'>/// # .arg(</span>
|
||||||
<span class='doccomment'>/// # Arg::new("debug").index(1)</span>
|
<span class='doccomment'>/// # Arg::with_name("debug").index(1)</span>
|
||||||
<span class='doccomment'>/// .possible_values(vec!["fast", "slow"])</span>
|
<span class='doccomment'>/// .possible_values(vec!["fast", "slow"])</span>
|
||||||
<span class='doccomment'>/// # ).get_matches();</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'><</span><span class='kw-2'>&</span><span class='lifetime'>'p</span> <span class='ident'>str</span><span class='op'>></span>) <span class='op'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></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'><</span><span class='kw-2'>&</span><span class='lifetime'>'p</span> <span class='ident'>str</span><span class='op'>></span>) <span class='op'>-></span> <span class='ident'>Arg</span><span class='op'><</span><span class='lifetime'>'n</span>, <span class='lifetime'>'l</span>, <span class='lifetime'>'h</span>, <span class='lifetime'>'b</span>, <span class='lifetime'>'p</span>, <span class='lifetime'>'r</span><span class='op'>></span> {
|
||||||
|
|
Loading…
Reference in a new issue