Merge branch 'dev'

This commit is contained in:
Kevin K 2015-03-01 16:59:02 -05:00
commit 875c8b67cc
12 changed files with 213 additions and 89 deletions

View file

@ -43,7 +43,7 @@
<section id='main' class="content mod">
<h1 class='fqn'><span class='in-band'>Crate <a class='mod' href=''>clap</a><wbr></span><span class='out-of-band'><a href='stability.html'>[stability]</a> <span id='render-detail'>
<a id="collapse-all" href="#">[-]</a>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-0' href='../src/clap/lib.rs.html#1-91'>[src]</a></span></h1>
</span><a id='src-0' href='../src/clap/lib.rs.html#1-90'>[src]</a></span></h1>
<div class='docblock'><p>A simply library for parsing command line arguments when writing
command line and console applications.</p>
@ -57,7 +57,6 @@
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>clap</span>;
<span class='kw'>use</span> <span class='ident'>clap</span>::{<span class='ident'>Arg</span>, <span class='ident'>App</span>};
<span class='comment'>// ...</span>

View file

@ -43,7 +43,7 @@
<section id='main' class="content struct">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>App</a><wbr></span><span class='out-of-band'><span id='render-detail'>
<a id="collapse-all" href="#">[-]</a>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-19' href='../src/clap/app.rs.html#35-57'>[src]</a></span></h1>
</span><a id='src-19' href='../src/clap/app.rs.html#37-59'>[src]</a></span></h1>
<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 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;,
@ -63,7 +63,8 @@
.<span class='ident'>version</span>(<span class='string'>&quot;1.0.2&quot;</span>)
.<span class='ident'>about</span>(<span class='string'>&quot;Explains in brief what the program does&quot;</span>)
.<span class='ident'>arg</span>(
<span class='comment'>// Add a possible command line argument</span>
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;in_file&quot;</span>).<span class='ident'>index</span>(<span class='number'>1</span>)
<span class='comment'>// Add other possible command line argument options here...</span>
)
.<span class='ident'>get_matches</span>();
@ -80,37 +81,38 @@ to the user when they print version or help and usage information.</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<span class='kw'>let</span> <span class='ident'>prog</span> <span class='op'>=</span> <span class='ident'>App</span>::<span class='ident'>new</span>(<span class='string'>&quot;myprog&quot;</span>);
<span class='kw'>let</span> <span class='ident'>prog</span> <span class='op'>=</span> <span class='ident'>App</span>::<span class='ident'>new</span>(<span class='string'>&quot;myprog&quot;</span>)
</pre>
</div><h4 id='method.author' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.author' class='fnname'>author</a>(&amp;mut self, a: &amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; &amp;mut <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a></code></h4>
<div class='docblock'><p>Sets a string of author(s)</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
.<span class='ident'>author</span>(<span class='string'>&quot;Kevin &lt;kbknapp@gmail.com&gt;&quot;</span>);
.<span class='ident'>author</span>(<span class='string'>&quot;Kevin &lt;kbknapp@gmail.com&gt;&quot;</span>)
</pre>
</div><h4 id='method.about' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.about' class='fnname'>about</a>(&amp;mut self, a: &amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; &amp;mut <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a></code></h4>
<div class='docblock'><p>Sets a string briefly describing what the program does</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
.<span class='ident'>about</span>(<span class='string'>&quot;Does really amazing things to great people&quot;</span>);
.<span class='ident'>about</span>(<span class='string'>&quot;Does really amazing things to great people&quot;</span>)
</pre>
</div><h4 id='method.version' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.version' class='fnname'>version</a>(&amp;mut self, v: &amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; &amp;mut <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a></code></h4>
<div class='docblock'><p>Sets a string of the version number</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
.<span class='ident'>version</span>(<span class='string'>&quot;v0.1.24&quot;</span>);
.<span class='ident'>version</span>(<span class='string'>&quot;v0.1.24&quot;</span>)
</pre>
</div><h4 id='method.arg' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.arg' class='fnname'>arg</a>(&amp;mut self, a: &amp;<a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>) -&gt; &amp;mut <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a></code></h4>
<div class='docblock'><p>Adds an argument to the list of valid possibilties</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;config&quot;</span>)
<span class='comment'>// Additional argument configuration goes here...</span>
);
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;config&quot;</span>)
.<span class='ident'>short</span>(<span class='string'>&quot;c&quot;</span>)
<span class='comment'>// Additional argument configuration goes here...</span>
)
</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>(&amp;mut self, args: <a class='struct' href='http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a>&lt;&amp;<a class='struct' href='../clap/struct.Arg.html' title='clap::Arg'>Arg</a>&gt;) -&gt; &amp;mut <a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a></code></h4>
<div class='docblock'><p>Adds arguments to the list of valid possibilties</p>
@ -118,7 +120,7 @@ to the user when they print version or help and usage information.</p>
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
.<span class='ident'>args</span>( <span class='macro'>vec</span><span class='macro'>!</span>[<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;config&quot;</span>).<span class='ident'>short</span>(<span class='string'>&quot;c&quot;</span>),
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;debug&quot;</span>).<span class='ident'>short</span>(<span class='string'>&quot;d&quot;</span>)]);
<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;debug&quot;</span>).<span class='ident'>short</span>(<span class='string'>&quot;d&quot;</span>)])
</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>(&amp;mut self) -&gt; <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a></code></h4>
</div></section>

View file

@ -43,7 +43,7 @@
<section id='main' class="content struct">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>Arg</a><wbr></span><span class='out-of-band'><span id='render-detail'>
<a id="collapse-all" href="#">[-]</a>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-4455' href='../src/clap/arg.rs.html#20-52'>[src]</a></span></h1>
</span><a id='src-4455' href='../src/clap/arg.rs.html#21-53'>[src]</a></span></h1>
<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 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">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>clap</a>::<wbr><a class='struct' href=''>ArgMatches</a><wbr></span><span class='out-of-band'><span id='render-detail'>
<a id="collapse-all" href="#">[-]</a>&nbsp;<a id="expand-all" href="#">[+]</a>
</span><a id='src-4245' href='../src/clap/argmatches.rs.html#48-58'>[src]</a></span></h1>
</span><a id='src-4245' href='../src/clap/argmatches.rs.html#49-59'>[src]</a></span></h1>
<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 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

@ -737,6 +737,26 @@
<span id="695">695</span>
<span id="696">696</span>
<span id="697">697</span>
<span id="698">698</span>
<span id="699">699</span>
<span id="700">700</span>
<span id="701">701</span>
<span id="702">702</span>
<span id="703">703</span>
<span id="704">704</span>
<span id="705">705</span>
<span id="706">706</span>
<span id="707">707</span>
<span id="708">708</span>
<span id="709">709</span>
<span id="710">710</span>
<span id="711">711</span>
<span id="712">712</span>
<span id="713">713</span>
<span id="714">714</span>
<span id="715">715</span>
<span id="716">716</span>
<span id="717">717</span>
</pre><pre class='rust '>
<span class='kw'>extern</span> <span class='kw'>crate</span> <span class='ident'>libc</span>;
@ -760,13 +780,15 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// let myprog = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .author(&quot;Me, me@mail.com&quot;)</span>
<span class='doccomment'>/// .version(&quot;1.0.2&quot;)</span>
<span class='doccomment'>/// .about(&quot;Explains in brief what the program does&quot;)</span>
<span class='doccomment'>/// .arg(</span>
<span class='doccomment'>/// // Add a possible command line argument</span>
<span class='doccomment'>/// Arg::new(&quot;in_file&quot;).index(1)</span>
<span class='doccomment'>/// // Add other possible command line argument options here...</span>
<span class='doccomment'>/// )</span>
<span class='doccomment'>/// .get_matches();</span>
<span class='doccomment'>///</span>
@ -802,8 +824,10 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// let prog = App::new(&quot;myprog&quot;);</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// let prog = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>new</span>(<span class='ident'>n</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'>App</span> {
<span class='ident'>App</span> {
@ -831,8 +855,11 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// .author(&quot;Kevin &lt;kbknapp@gmail.com&gt;&quot;);</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .author(&quot;Kevin &lt;kbknapp@gmail.com&gt;&quot;)</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>author</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='lifetime'>&#39;static</span> <span class='ident'>str</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='self'>self</span>.<span class='ident'>author</span> <span class='op'>=</span> <span class='prelude-val'>Some</span>(<span class='ident'>a</span>);
@ -843,8 +870,11 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// .about(&quot;Does really amazing things to great people&quot;);</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .about(&quot;Does really amazing things to great people&quot;)</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>about</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='lifetime'>&#39;static</span> <span class='ident'>str</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='self'>self</span>.<span class='ident'>about</span> <span class='op'>=</span> <span class='prelude-val'>Some</span>(<span class='ident'>a</span>);
@ -855,8 +885,11 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// .version(&quot;v0.1.24&quot;);</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .version(&quot;v0.1.24&quot;)</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>version</span>(<span class='kw-2'>&amp;</span><span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>v</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='kw-2'>&amp;</span><span class='kw-2'>mut</span> <span class='ident'>App</span> {
<span class='self'>self</span>.<span class='ident'>version</span> <span class='op'>=</span> <span class='prelude-val'>Some</span>(<span class='ident'>v</span>);
@ -867,10 +900,14 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .arg(Arg::new(&quot;config&quot;)</span>
<span class='doccomment'>/// // Additional argument configuration goes here...</span>
<span class='doccomment'>/// );</span>
<span class='doccomment'>/// .short(&quot;c&quot;)</span>
<span class='doccomment'>/// // Additional argument configuration goes here...</span>
<span class='doccomment'>/// )</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</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>) {
@ -968,9 +1005,12 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let app = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// .args( vec![Arg::new(&quot;config&quot;).short(&quot;c&quot;),</span>
<span class='doccomment'>/// Arg::new(&quot;debug&quot;).short(&quot;d&quot;)]);</span>
<span class='doccomment'>/// Arg::new(&quot;debug&quot;).short(&quot;d&quot;)])</span>
<span class='doccomment'>/// # .get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>args</span>(<span class='kw-2'>&amp;</span><span class='kw-2'>mut</span> <span class='self'>self</span>, <span class='ident'>args</span>: <span class='ident'>Vec</span><span class='op'>&lt;</span><span class='kw-2'>&amp;</span><span class='ident'>Arg</span><span class='op'>&gt;</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'>for</span> <span class='ident'>arg</span> <span class='kw'>in</span> <span class='ident'>args</span>.<span class='ident'>iter</span>() {

View file

@ -364,6 +364,20 @@
<span id="322">322</span>
<span id="323">323</span>
<span id="324">324</span>
<span id="325">325</span>
<span id="326">326</span>
<span id="327">327</span>
<span id="328">328</span>
<span id="329">329</span>
<span id="330">330</span>
<span id="331">331</span>
<span id="332">332</span>
<span id="333">333</span>
<span id="334">334</span>
<span id="335">335</span>
<span id="336">336</span>
<span id="337">337</span>
<span id="338">338</span>
</pre><pre class='rust '>
<span class='doccomment'>/// The abstract representation of a command line argument used by the consumer of the library.</span>
<span class='doccomment'>/// </span>
@ -375,7 +389,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// Arg::new(&quot;conifg&quot;)</span>
@ -429,10 +444,12 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// # .short(&quot;c&quot;)</span>
<span class='doccomment'>/// # ).get_matches();</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>new</span>(<span class='ident'>n</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</span> {
<span class='ident'>Arg</span> {
@ -461,7 +478,8 @@
<span class='doccomment'>/// mistakenly sets the short to `-o` or the like.</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
@ -485,7 +503,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
@ -501,7 +520,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
@ -523,7 +543,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
@ -543,7 +564,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .mutually_excludes(&quot;debug&quot;)</span>
<span class='doccomment'>/// # ).get_matches();</span>
@ -565,7 +587,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .mutually_excludes_all(</span>
<span class='doccomment'>/// vec![&quot;debug&quot;, &quot;input&quot;])</span>
@ -588,7 +611,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .requires(&quot;debug&quot;)</span>
<span class='doccomment'>/// # ).get_matches();</span>
@ -609,7 +633,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let myprog = App::new(&quot;myprog&quot;).arg(Arg::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .requires_all(</span>
<span class='doccomment'>/// vec![&quot;debug&quot;, &quot;input&quot;])</span>
@ -632,7 +657,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
@ -653,7 +679,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;conifg&quot;)</span>
@ -676,7 +703,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .arg(</span>
<span class='doccomment'>/// # Arg::new(&quot;debug&quot;)</span>

View file

@ -190,6 +190,14 @@
<span id="148">148</span>
<span id="149">149</span>
<span id="150">150</span>
<span id="151">151</span>
<span id="152">152</span>
<span id="153">153</span>
<span id="154">154</span>
<span id="155">155</span>
<span id="156">156</span>
<span id="157">157</span>
<span id="158">158</span>
</pre><pre class='rust '>
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>collections</span>::<span class='ident'>HashMap</span>;
<span class='kw'>use</span> <span class='ident'>std</span>::<span class='ident'>collections</span>::<span class='ident'>HashSet</span>;
@ -204,7 +212,8 @@
<span class='doccomment'>/// Fields of `ArgMatches` aren&#39;t designed to be used directly, only </span>
<span class='doccomment'>/// the methods in order to query information.</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// let matches = App::new(&quot;MyApp&quot;)</span>
<span class='doccomment'>/// // adding of arguments and configuration goes here...</span>
<span class='doccomment'>/// # .arg(Arg::new(&quot;config&quot;)</span>
@ -213,7 +222,7 @@
<span class='doccomment'>/// # .takes_value(true))</span>
<span class='doccomment'>/// # .arg(Arg::new(&quot;debug&quot;)</span>
<span class='doccomment'>/// # .short(&quot;d&quot;)</span>
<span class='doccomment'>/// # .multiple(true)</span>
<span class='doccomment'>/// # .multiple(true))</span>
<span class='doccomment'>/// .get_matches();</span>
<span class='doccomment'>/// // if you had an argument named &quot;output&quot; that takes a value </span>
<span class='doccomment'>/// if let Some(o) = matches.value_of(&quot;output&quot;) {</span>
@ -256,7 +265,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// let matches = App::new(&quot;myprog&quot;).get_matches();</span>
<span class='doccomment'>/// ```</span>
<span class='kw'>pub</span> <span class='kw'>fn</span> <span class='ident'>new</span>(<span class='ident'>app</span>: <span class='kw-2'>&amp;</span><span class='ident'>App</span>) <span class='op'>-&gt;</span> <span class='ident'>ArgMatches</span> {
@ -279,7 +289,9 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myapp&quot;).arg(Arg::new(&quot;output&quot;).takes_value(true)).get_matches();</span>
<span class='doccomment'>/// if let Some(o) = matches.value_of(&quot;output&quot;) {</span>
<span class='doccomment'>/// println!(&quot;Value for output: {}&quot;, o);</span>
<span class='doccomment'>/// }</span>
@ -304,7 +316,9 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myapp&quot;).arg(Arg::new(&quot;output&quot;).takes_value(true)).get_matches();</span>
<span class='doccomment'>/// if matches.is_present(&quot;output&quot;) {</span>
<span class='doccomment'>/// println!(&quot;The output argument was used!&quot;);</span>
<span class='doccomment'>/// }</span>
@ -327,7 +341,9 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// Example:</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```rust.example</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myapp&quot;).arg(Arg::new(&quot;output&quot;).takes_value(true)).get_matches();</span>
<span class='doccomment'>/// if matches.occurrences_of(&quot;debug&quot;) &gt; 1 {</span>
<span class='doccomment'>/// println!(&quot;Debug mode is REALLY on&quot;);</span>
<span class='doccomment'>/// } else {</span>

View file

@ -130,11 +130,10 @@
<span id="88">88</span>
<span id="89">89</span>
<span id="90">90</span>
<span id="91">91</span>
</pre><pre class='rust '>
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>crate_type</span><span class='op'>=</span> <span class='string'>&quot;lib&quot;</span>]</span>
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>feature</span>(<span class='ident'>collections</span>, <span class='ident'>core</span>, <span class='ident'>libc</span>, <span class='ident'>env</span>)]</span>
<span class='attribute'>#<span class='op'>!</span>[<span class='ident'>feature</span>(<span class='ident'>collections</span>, <span class='ident'>core</span>, <span class='ident'>libc</span>)]</span>
<span class='doccomment'>//! A simply library for parsing command line arguments when writing </span>
<span class='doccomment'>//! command line and console applications.</span>
@ -150,8 +149,7 @@
<span class='doccomment'>//!</span>
<span class='doccomment'>//! Example:</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ```rust.example</span>
<span class='doccomment'>//! extern crate clap;</span>
<span class='doccomment'>//! ```no_run</span>
<span class='doccomment'>//! use clap::{Arg, App};</span>
<span class='doccomment'>//!</span>
<span class='doccomment'>//! // ...</span>

View file

@ -20,13 +20,15 @@ use args::PosArg;
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// let myprog = App::new("myprog")
/// .author("Me, me@mail.com")
/// .version("1.0.2")
/// .about("Explains in brief what the program does")
/// .arg(
/// // Add a possible command line argument
/// Arg::new("in_file").index(1)
/// // Add other possible command line argument options here...
/// )
/// .get_matches();
///
@ -62,8 +64,10 @@ impl App {
///
/// Example:
///
/// ```rust.example
/// let prog = App::new("myprog");
/// ```no_run
/// # use clap::{App, Arg};
/// let prog = App::new("myprog")
/// # .get_matches();
/// ```
pub fn new(n: &'static str) -> App {
App {
@ -91,8 +95,11 @@ impl App {
///
/// Example:
///
/// ```rust.example
/// .author("Kevin <kbknapp@gmail.com>");
/// ```no_run
/// # use clap::{App, Arg};
/// # let app = App::new("myprog")
/// .author("Kevin <kbknapp@gmail.com>")
/// # .get_matches();
/// ```
pub fn author(&mut self, a: &'static str) -> &mut App {
self.author = Some(a);
@ -103,8 +110,11 @@ impl App {
///
/// Example:
///
/// ```rust.example
/// .about("Does really amazing things to great people");
/// ```no_run
/// # use clap::{App, Arg};
/// # let app = App::new("myprog")
/// .about("Does really amazing things to great people")
/// # .get_matches();
/// ```
pub fn about(&mut self, a: &'static str) -> &mut App {
self.about = Some(a);
@ -115,8 +125,11 @@ impl App {
///
/// Example:
///
/// ```rust.example
/// .version("v0.1.24");
/// ```no_run
/// # use clap::{App, Arg};
/// # let app = App::new("myprog")
/// .version("v0.1.24")
/// # .get_matches();
/// ```
pub fn version(&mut self, v: &'static str)-> &mut App {
self.version = Some(v);
@ -127,10 +140,14 @@ impl App {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let app = App::new("myprog")
/// .arg(Arg::new("config")
/// // Additional argument configuration goes here...
/// );
/// .short("c")
/// // Additional argument configuration goes here...
/// )
/// # .get_matches();
/// ```
pub fn arg(&mut self, a: &Arg) -> &mut App {
if self.arg_list.contains(a.name) {
@ -228,9 +245,12 @@ impl App {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let app = App::new("myprog")
/// .args( vec![Arg::new("config").short("c"),
/// Arg::new("debug").short("d")]);
/// Arg::new("debug").short("d")])
/// # .get_matches();
/// ```
pub fn args(&mut self, args: Vec<&Arg>) -> &mut App {
for arg in args.iter() {

View file

@ -8,7 +8,8 @@
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// Arg::new("conifg")
@ -62,10 +63,12 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// Arg::new("conifg")
/// # .short("c")
/// # ).get_matches();
pub fn new(n: &'static str) -> Arg {
Arg {
@ -94,7 +97,8 @@ impl Arg {
/// mistakenly sets the short to `-o` or the like.
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// # Arg::new("conifg")
@ -118,7 +122,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// # Arg::new("conifg")
@ -134,7 +139,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// # Arg::new("conifg")
@ -156,7 +162,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// # Arg::new("conifg")
@ -176,7 +183,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let myprog = App::new("myprog").arg(Arg::new("conifg")
/// .mutually_excludes("debug")
/// # ).get_matches();
@ -198,7 +206,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let myprog = App::new("myprog").arg(Arg::new("conifg")
/// .mutually_excludes_all(
/// vec!["debug", "input"])
@ -221,7 +230,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let myprog = App::new("myprog").arg(Arg::new("conifg")
/// .requires("debug")
/// # ).get_matches();
@ -242,7 +252,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let myprog = App::new("myprog").arg(Arg::new("conifg")
/// .requires_all(
/// vec!["debug", "input"])
@ -265,7 +276,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// # Arg::new("conifg")
@ -286,7 +298,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// # Arg::new("conifg")
@ -309,7 +322,8 @@ impl Arg {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myprog")
/// # .arg(
/// # Arg::new("debug")

View file

@ -11,7 +11,8 @@ use args::{ FlagArg, OptArg, PosArg };
/// Fields of `ArgMatches` aren't designed to be used directly, only
/// the methods in order to query information.
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// let matches = App::new("MyApp")
/// // adding of arguments and configuration goes here...
/// # .arg(Arg::new("config")
@ -20,7 +21,7 @@ use args::{ FlagArg, OptArg, PosArg };
/// # .takes_value(true))
/// # .arg(Arg::new("debug")
/// # .short("d")
/// # .multiple(true)
/// # .multiple(true))
/// .get_matches();
/// // if you had an argument named "output" that takes a value
/// if let Some(o) = matches.value_of("output") {
@ -63,7 +64,8 @@ impl ArgMatches {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// let matches = App::new("myprog").get_matches();
/// ```
pub fn new(app: &App) -> ArgMatches {
@ -86,7 +88,9 @@ impl ArgMatches {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myapp").arg(Arg::new("output").takes_value(true)).get_matches();
/// if let Some(o) = matches.value_of("output") {
/// println!("Value for output: {}", o);
/// }
@ -111,7 +115,9 @@ impl ArgMatches {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myapp").arg(Arg::new("output").takes_value(true)).get_matches();
/// if matches.is_present("output") {
/// println!("The output argument was used!");
/// }
@ -134,7 +140,9 @@ impl ArgMatches {
///
/// Example:
///
/// ```rust.example
/// ```no_run
/// # use clap::{App, Arg};
/// # let matches = App::new("myapp").arg(Arg::new("output").takes_value(true)).get_matches();
/// if matches.occurrences_of("debug") > 1 {
/// println!("Debug mode is REALLY on");
/// } else {

View file

@ -1,6 +1,6 @@
#![crate_type= "lib"]
#![feature(collections, core, libc, env)]
#![feature(collections, core, libc)]
//! A simply library for parsing command line arguments when writing
//! command line and console applications.
@ -16,8 +16,7 @@
//!
//! Example:
//!
//! ```rust.example
//! extern crate clap;
//! ```no_run
//! use clap::{Arg, App};
//!
//! // ...