updated docs

This commit is contained in:
Kevin K 2015-02-28 20:15:04 -05:00
parent 1c752d38d1
commit 3c0b050a26
9 changed files with 69 additions and 29 deletions

View file

@ -69,15 +69,15 @@ Command Line Argument Parser written in Rust
MyApp [FLAGS] [OPTIONS] [POSITIONAL] MyApp [FLAGS] [OPTIONS] [POSITIONAL]
FLAGS: FLAGS:
-d Turn debugging information on -d Turn debugging information on
-h,--help Prints this message -h,--help Prints this message
-v,--version Prints version information -v,--version Prints version information
OPTIONS: OPTIONS:
-c,--config <config> Sets a custom config file -c,--config <config> Sets a custom config file
POSITIONAL ARGUMENTS: POSITIONAL ARGUMENTS:
output Sets an optional output file output Sets an optional output file
``` ```
## Installation ## Installation

View file

@ -109,15 +109,15 @@
MyApp [FLAGS] [OPTIONS] [POSITIONAL] MyApp [FLAGS] [OPTIONS] [POSITIONAL]
FLAGS: FLAGS:
-d Turn debugging information on d--help Turn debugging information on
-h,--help Prints this message h--version,--help Prints this message
-v,--version Prints version information vd--help,--version Prints version information
OPTIONS: OPTIONS:
-c,--config &lt;config&gt; Sets a custom config file ch--version,--config &lt;config&gt; Sets a custom config file
POSITIONAL ARGUMENTS: POSITIONAL ARGUMENTS:
output Sets an optional output file output Sets an optional output file
</code></pre> </code></pre>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2> </div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table> <table>

View file

@ -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=''>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>&nbsp;<a id="expand-all" href="#">[+]</a> <a id="collapse-all" href="#">[-]</a>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-19' href='../src/clap/app.rs.html#35-55'>[src]</a></span></h1> </span><a id='src-19' href='../src/clap/app.rs.html#35-57'>[src]</a></span></h1>
<pre class='rust struct'>pub struct App { <pre class='rust struct'>pub struct App {
pub name: &amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, pub name: &amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>,
pub author: <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;, pub author: <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;,

View file

@ -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>&nbsp;<a id="expand-all" href="#">[+]</a> <a id="collapse-all" href="#">[-]</a>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-4288' href='../src/clap/arg.rs.html#20-52'>[src]</a></span></h1> </span><a id='src-4455' href='../src/clap/arg.rs.html#20-52'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Arg { <pre class='rust struct'>pub struct Arg {
pub name: &amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, pub name: &amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>,
pub short: <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a href='http://doc.rust-lang.org/nightly/std/primitive.char.html'>char</a>&gt;, pub short: <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a href='http://doc.rust-lang.org/nightly/std/primitive.char.html'>char</a>&gt;,

View file

@ -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>&nbsp;<a id="expand-all" href="#">[+]</a> <a id="collapse-all" href="#">[-]</a>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-4078' href='../src/clap/argmatches.rs.html#48-58'>[src]</a></span></h1> </span><a id='src-4245' href='../src/clap/argmatches.rs.html#48-58'>[src]</a></span></h1>
<pre class='rust struct'>pub struct ArgMatches { <pre class='rust struct'>pub struct ArgMatches {
pub required: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a>&lt;&amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;, pub required: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a>&lt;&amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;,
pub blacklist: <a class='struct' href='http://doc.rust-lang.org/nightly/std/collections/hash/set/struct.HashSet.html' title='std::collections::hash::set::HashSet'>HashSet</a>&lt;&amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;, pub blacklist: <a class='struct' href='http://doc.rust-lang.org/nightly/std/collections/hash/set/struct.HashSet.html' title='std::collections::hash::set::HashSet'>HashSet</a>&lt;&amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;,

View file

@ -717,6 +717,26 @@
<span id="675">675</span> <span id="675">675</span>
<span id="676">676</span> <span id="676">676</span>
<span id="677">677</span> <span id="677">677</span>
<span id="678">678</span>
<span id="679">679</span>
<span id="680">680</span>
<span id="681">681</span>
<span id="682">682</span>
<span id="683">683</span>
<span id="684">684</span>
<span id="685">685</span>
<span id="686">686</span>
<span id="687">687</span>
<span id="688">688</span>
<span id="689">689</span>
<span id="690">690</span>
<span id="691">691</span>
<span id="692">692</span>
<span id="693">693</span>
<span id="694">694</span>
<span id="695">695</span>
<span id="696">696</span>
<span id="697">697</span>
</pre><pre class='rust '> </pre><pre class='rust '>
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>libc</span>; <span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>libc</span>;
@ -771,6 +791,8 @@
<span class='ident'>needs_short_version</span>: <span class='ident'>bool</span>, <span class='ident'>needs_short_version</span>: <span class='ident'>bool</span>,
<span class='ident'>required</span>: <span class='ident'>HashSet</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;static</span> <span class='ident'>str</span><span class='op'>&gt;</span>, <span class='ident'>required</span>: <span class='ident'>HashSet</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;static</span> <span class='ident'>str</span><span class='op'>&gt;</span>,
<span class='ident'>arg_list</span>: <span class='ident'>HashSet</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;static</span> <span class='ident'>str</span><span class='op'>&gt;</span>, <span class='ident'>arg_list</span>: <span class='ident'>HashSet</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;static</span> <span class='ident'>str</span><span class='op'>&gt;</span>,
<span class='ident'>short_list</span>: <span class='ident'>HashSet</span><span class='op'>&lt;</span><span class='ident'>char</span><span class='op'>&gt;</span>,
<span class='ident'>long_list</span>: <span class='ident'>HashSet</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;static</span> <span class='ident'>str</span><span class='op'>&gt;</span>,
<span class='ident'>blacklist</span>: <span class='ident'>HashSet</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;static</span> <span class='ident'>str</span><span class='op'>&gt;</span>, <span class='ident'>blacklist</span>: <span class='ident'>HashSet</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='lifetime'>&#39;static</span> <span class='ident'>str</span><span class='op'>&gt;</span>,
} }
@ -799,6 +821,8 @@
<span class='ident'>needs_short_version</span>: <span class='boolval'>true</span>, <span class='ident'>needs_short_version</span>: <span class='boolval'>true</span>,
<span class='ident'>required</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(), <span class='ident'>required</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(),
<span class='ident'>arg_list</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(), <span class='ident'>arg_list</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(),
<span class='ident'>short_list</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(),
<span class='ident'>long_list</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(),
<span class='ident'>blacklist</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(), <span class='ident'>blacklist</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(),
} }
} }
@ -851,6 +875,22 @@
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>arg</span>(<span class='kw-2'>&amp;</span><span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>a</span>: <span class='kw-2'>&amp;</span><span class='ident'>Arg</span>) <span class='op'>-&gt;</span> <span class='kw-2'>&amp;</span><span class='kw-2'>mut</span> <span class='ident'>App</span> { <span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>arg</span>(<span class='kw-2'>&amp;</span><span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>a</span>: <span class='kw-2'>&amp;</span><span class='ident'>Arg</span>) <span class='op'>-&gt;</span> <span class='kw-2'>&amp;</span><span class='kw-2'>mut</span> <span class='ident'>App</span> {
<span class='kw'>if</span> <span class='self'>self</span>.<span class='ident'>arg_list</span>.<span class='ident'>contains</span>(<span class='ident'>a</span>.<span class='ident'>name</span>) { <span class='kw'>if</span> <span class='self'>self</span>.<span class='ident'>arg_list</span>.<span class='ident'>contains</span>(<span class='ident'>a</span>.<span class='ident'>name</span>) {
<span class='macro'>panic</span><span class='macro'>!</span>(<span class='string'>&quot;Argument name must be unique, \&quot;{}\&quot; is already in use&quot;</span>, <span class='ident'>a</span>.<span class='ident'>name</span>); <span class='macro'>panic</span><span class='macro'>!</span>(<span class='string'>&quot;Argument name must be unique, \&quot;{}\&quot; is already in use&quot;</span>, <span class='ident'>a</span>.<span class='ident'>name</span>);
} <span class='kw'>else</span> {
<span class='self'>self</span>.<span class='ident'>arg_list</span>.<span class='ident'>insert</span>(<span class='ident'>a</span>.<span class='ident'>name</span>);
}
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>s</span>) <span class='op'>=</span> <span class='ident'>a</span>.<span class='ident'>short</span> {
<span class='kw'>if</span> <span class='self'>self</span>.<span class='ident'>short_list</span>.<span class='ident'>contains</span>(<span class='ident'>s</span>) {
<span class='macro'>panic</span><span class='macro'>!</span>(<span class='string'>&quot;Argument short must be unique, -{} is already in use&quot;</span>, <span class='ident'>s</span>);
} <span class='kw'>else</span> {
<span class='self'>self</span>.<span class='ident'>short_list</span>.<span class='ident'>insert</span>(<span class='op'>*</span><span class='ident'>s</span>);
}
}
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>l</span>) <span class='op'>=</span> <span class='ident'>a</span>.<span class='ident'>long</span> {
<span class='kw'>if</span> <span class='self'>self</span>.<span class='ident'>long_list</span>.<span class='ident'>contains</span>(<span class='ident'>l</span>) {
<span class='macro'>panic</span><span class='macro'>!</span>(<span class='string'>&quot;Argument long must be unique, --{} is already in use&quot;</span>, <span class='ident'>l</span>);
} <span class='kw'>else</span> {
<span class='self'>self</span>.<span class='ident'>long_list</span>.<span class='ident'>insert</span>(<span class='ident'>l</span>);
}
} }
<span class='kw'>if</span> <span class='ident'>a</span>.<span class='ident'>required</span> { <span class='kw'>if</span> <span class='ident'>a</span>.<span class='ident'>required</span> {
<span class='self'>self</span>.<span class='ident'>required</span>.<span class='ident'>insert</span>(<span class='ident'>a</span>.<span class='ident'>name</span>); <span class='self'>self</span>.<span class='ident'>required</span>.<span class='ident'>insert</span>(<span class='ident'>a</span>.<span class='ident'>name</span>);
@ -974,7 +1014,7 @@
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;&quot;</span>); <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;&quot;</span>);
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;FLAGS:&quot;</span>); <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;FLAGS:&quot;</span>);
<span class='kw'>for</span> (_, <span class='ident'>v</span>) <span class='kw'>in</span> <span class='self'>self</span>.<span class='ident'>flags</span>.<span class='ident'>iter</span>() { <span class='kw'>for</span> (_, <span class='ident'>v</span>) <span class='kw'>in</span> <span class='self'>self</span>.<span class='ident'>flags</span>.<span class='ident'>iter</span>() {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;{}{}\t{}&quot;</span>, <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;\t{}{}\t{}&quot;</span>,
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>s</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>short</span>{<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot;-{}&quot;</span>,<span class='ident'>s</span>)}<span class='kw'>else</span>{<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; &quot;</span>)}, <span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>s</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>short</span>{<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot;-{}&quot;</span>,<span class='ident'>s</span>)}<span class='kw'>else</span>{<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; &quot;</span>)},
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>l</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>long</span> {<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot;,--{}&quot;</span>,<span class='ident'>l</span>)}<span class='kw'>else</span> {<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; \t&quot;</span>)}, <span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>l</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>long</span> {<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot;,--{}&quot;</span>,<span class='ident'>l</span>)}<span class='kw'>else</span> {<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; \t&quot;</span>)},
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>h</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>help</span> {<span class='op'>*</span><span class='ident'>h</span>} <span class='kw'>else</span> {<span class='string'>&quot; &quot;</span>} ); <span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>h</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>help</span> {<span class='op'>*</span><span class='ident'>h</span>} <span class='kw'>else</span> {<span class='string'>&quot; &quot;</span>} );
@ -984,7 +1024,7 @@
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;&quot;</span>); <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;&quot;</span>);
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;OPTIONS:&quot;</span>); <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;OPTIONS:&quot;</span>);
<span class='kw'>for</span> (_, <span class='ident'>v</span>) <span class='kw'>in</span> <span class='self'>self</span>.<span class='ident'>opts</span>.<span class='ident'>iter</span>() { <span class='kw'>for</span> (_, <span class='ident'>v</span>) <span class='kw'>in</span> <span class='self'>self</span>.<span class='ident'>opts</span>.<span class='ident'>iter</span>() {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;{}{}{}\t\t{}&quot;</span>, <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;\t{}{}{}\t\t{}&quot;</span>,
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>s</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>short</span>{<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot;-{}&quot;</span>,<span class='ident'>s</span>)}<span class='kw'>else</span>{<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; &quot;</span>)}, <span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>s</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>short</span>{<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot;-{}&quot;</span>,<span class='ident'>s</span>)}<span class='kw'>else</span>{<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; &quot;</span>)},
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>l</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>long</span> {<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot;,--{}&quot;</span>,<span class='ident'>l</span>)}<span class='kw'>else</span> {<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; &quot;</span>)}, <span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>l</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>long</span> {<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot;,--{}&quot;</span>,<span class='ident'>l</span>)}<span class='kw'>else</span> {<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; &quot;</span>)},
<span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; &lt;{}&gt;&quot;</span>, <span class='ident'>v</span>.<span class='ident'>name</span>), <span class='macro'>format</span><span class='macro'>!</span>(<span class='string'>&quot; &lt;{}&gt;&quot;</span>, <span class='ident'>v</span>.<span class='ident'>name</span>),
@ -995,7 +1035,7 @@
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;&quot;</span>); <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;&quot;</span>);
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;POSITIONAL ARGUMENTS:&quot;</span>); <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;POSITIONAL ARGUMENTS:&quot;</span>);
<span class='kw'>for</span> (_, <span class='ident'>v</span>) <span class='kw'>in</span> <span class='self'>self</span>.<span class='ident'>positionals_idx</span>.<span class='ident'>iter</span>() { <span class='kw'>for</span> (_, <span class='ident'>v</span>) <span class='kw'>in</span> <span class='self'>self</span>.<span class='ident'>positionals_idx</span>.<span class='ident'>iter</span>() {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;{}\t\t\t{}&quot;</span>, <span class='ident'>v</span>.<span class='ident'>name</span>, <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;\t{}\t\t\t{}&quot;</span>, <span class='ident'>v</span>.<span class='ident'>name</span>,
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>h</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>help</span> {<span class='op'>*</span><span class='ident'>h</span>} <span class='kw'>else</span> {<span class='string'>&quot; &quot;</span>} ); <span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='kw-2'>ref</span> <span class='ident'>h</span>) <span class='op'>=</span> <span class='ident'>v</span>.<span class='ident'>help</span> {<span class='op'>*</span><span class='ident'>h</span>} <span class='kw'>else</span> {<span class='string'>&quot; &quot;</span>} );
} }
} }

View file

@ -204,15 +204,15 @@
<span class='doccomment'>//! MyApp [FLAGS] [OPTIONS] [POSITIONAL]</span> <span class='doccomment'>//! MyApp [FLAGS] [OPTIONS] [POSITIONAL]</span>
<span class='doccomment'>//! </span> <span class='doccomment'>//! </span>
<span class='doccomment'>//! FLAGS:</span> <span class='doccomment'>//! FLAGS:</span>
<span class='doccomment'>//! -d Turn debugging information on</span> <span class='doccomment'>//! d--help Turn debugging information on</span>
<span class='doccomment'>//! -h,--help Prints this message</span> <span class='doccomment'>//! h--version,--help Prints this message</span>
<span class='doccomment'>//! -v,--version Prints version information</span> <span class='doccomment'>//! vd--help,--version Prints version information</span>
<span class='doccomment'>//! </span> <span class='doccomment'>//! </span>
<span class='doccomment'>//! OPTIONS:</span> <span class='doccomment'>//! OPTIONS:</span>
<span class='doccomment'>//! -c,--config &lt;config&gt; Sets a custom config file</span> <span class='doccomment'>//! ch--version,--config &lt;config&gt; Sets a custom config file</span>
<span class='doccomment'>//!</span> <span class='doccomment'>//!</span>
<span class='doccomment'>//! POSITIONAL ARGUMENTS:</span> <span class='doccomment'>//! POSITIONAL ARGUMENTS:</span>
<span class='doccomment'>//! output Sets an optional output file</span> <span class='doccomment'>//! output Sets an optional output file</span>
<span class='doccomment'>//! ```</span> <span class='doccomment'>//! ```</span>
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>argmatches</span>::<span class='ident'>ArgMatches</span>; <span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>argmatches</span>::<span class='ident'>ArgMatches</span>;

View file

@ -274,7 +274,7 @@ impl App {
println!(""); println!("");
println!("FLAGS:"); println!("FLAGS:");
for (_, v) in self.flags.iter() { for (_, v) in self.flags.iter() {
println!("{}{}\t{}", println!("\t{}{}\t{}",
if let Some(ref s) = v.short{format!("-{}",s)}else{format!(" ")}, if let Some(ref s) = v.short{format!("-{}",s)}else{format!(" ")},
if let Some(ref l) = v.long {format!(",--{}",l)}else {format!(" \t")}, if let Some(ref l) = v.long {format!(",--{}",l)}else {format!(" \t")},
if let Some(ref h) = v.help {*h} else {" "} ); if let Some(ref h) = v.help {*h} else {" "} );
@ -284,7 +284,7 @@ impl App {
println!(""); println!("");
println!("OPTIONS:"); println!("OPTIONS:");
for (_, v) in self.opts.iter() { for (_, v) in self.opts.iter() {
println!("{}{}{}\t\t{}", println!("\t{}{}{}\t\t{}",
if let Some(ref s) = v.short{format!("-{}",s)}else{format!(" ")}, if let Some(ref s) = v.short{format!("-{}",s)}else{format!(" ")},
if let Some(ref l) = v.long {format!(",--{}",l)}else {format!(" ")}, if let Some(ref l) = v.long {format!(",--{}",l)}else {format!(" ")},
format!(" <{}>", v.name), format!(" <{}>", v.name),
@ -295,7 +295,7 @@ impl App {
println!(""); println!("");
println!("POSITIONAL ARGUMENTS:"); println!("POSITIONAL ARGUMENTS:");
for (_, v) in self.positionals_idx.iter() { for (_, v) in self.positionals_idx.iter() {
println!("{}\t\t\t{}", v.name, println!("\t{}\t\t\t{}", v.name,
if let Some(ref h) = v.help {*h} else {" "} ); if let Some(ref h) = v.help {*h} else {" "} );
} }
} }

View file

@ -70,15 +70,15 @@
//! MyApp [FLAGS] [OPTIONS] [POSITIONAL] //! MyApp [FLAGS] [OPTIONS] [POSITIONAL]
//! //!
//! FLAGS: //! FLAGS:
//! -d Turn debugging information on //! d--help Turn debugging information on
//! -h,--help Prints this message //! h--version,--help Prints this message
//! -v,--version Prints version information //! vd--help,--version Prints version information
//! //!
//! OPTIONS: //! OPTIONS:
//! -c,--config <config> Sets a custom config file //! ch--version,--config <config> Sets a custom config file
//! //!
//! POSITIONAL ARGUMENTS: //! POSITIONAL ARGUMENTS:
//! output Sets an optional output file //! output Sets an optional output file
//! ``` //! ```
pub use argmatches::ArgMatches; pub use argmatches::ArgMatches;