Rebuilt docs

This commit is contained in:
Kevin K 2015-03-15 21:06:15 -04:00
parent 152aa8919a
commit 43ddb14972
5 changed files with 68 additions and 71 deletions

View file

@ -57,7 +57,7 @@
<p>Example:</p>
<pre id='rust-example-rendered' class='rust '>
<span class='kw'>use</span> <span class='ident'>clap</span>::{<span class='ident'>Arg</span>, <span class='ident'>App</span>};
<span class='kw'>use</span> <span class='ident'>clap</span>::{<span class='ident'>Arg</span>, <span class='ident'>App</span>, <span class='ident'>SubCommand</span>};
<span class='comment'>// ...</span>
@ -77,7 +77,7 @@
.<span class='ident'>short</span>(<span class='string'>&quot;d&quot;</span>)
.<span class='ident'>multiple</span>(<span class='boolval'>true</span>)
.<span class='ident'>help</span>(<span class='string'>&quot;Turn debugging information on&quot;</span>))
.<span class='ident'>subcomamnd</span>(<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>&quot;test&quot;</span>)
.<span class='ident'>subcommand</span>(<span class='ident'>SubCommand</span>::<span class='ident'>new</span>(<span class='string'>&quot;test&quot;</span>)
.<span class='ident'>about</span>(<span class='string'>&quot;Has test sub functionality&quot;</span>)
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;verbose&quot;</span>)
.<span class='ident'>short</span>(<span class='string'>&quot;v&quot;</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=''>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-4545' href='../src/clap/argmatches.rs.html#61-67'>[src]</a></span></h1>
</span><a id='src-4545' href='../src/clap/argmatches.rs.html#60-66'>[src]</a></span></h1>
<pre class='rust struct'>pub struct ArgMatches {
pub matches_of: &amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>,
pub flags: <a class='struct' href='http://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html' title='std::collections::hash::map::HashMap'>HashMap</a>&lt;&amp;'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, FlagArg&gt;,
@ -58,41 +58,40 @@ the methods in order to query information.</p>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
<span class='kw'>let</span> <span class='ident'>matches</span> <span class='op'>=</span> <span class='ident'>App</span>::<span class='ident'>new</span>(<span class='string'>&quot;MyApp&quot;</span>)
<span class='kw'>let</span> <span class='ident'>matches</span> <span class='op'>=</span> <span class='ident'>App</span>::<span class='ident'>new</span>(<span class='string'>&quot;MyApp&quot;</span>)
<span class='comment'>// adding of arguments and configuration goes here...</span>
.<span class='ident'>get_matches</span>();
<span class='comment'>// if you had an argument named &quot;output&quot; that takes a value </span>
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='ident'>o</span>) <span class='op'>=</span> <span class='ident'>matches</span>.<span class='ident'>value_of</span>(<span class='string'>&quot;output&quot;</span>) {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Value for output: {}&quot;</span>, <span class='ident'>o</span>);
}
<span class='comment'>// if you had an argument named &quot;output&quot; that takes a value </span>
<span class='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='ident'>o</span>) <span class='op'>=</span> <span class='ident'>matches</span>.<span class='ident'>value_of</span>(<span class='string'>&quot;output&quot;</span>) {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Value for output: {}&quot;</span>, <span class='ident'>o</span>);
}
<span class='comment'>// Although not advised, if you have a required argument</span>
<span class='comment'>// you can call .unwrap() because the program will exit long before</span>
<span class='comment'>// here at noticing the user didn&#39;t supply a required argument...</span>
<span class='comment'>// use at your own risk ;)</span>
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Config file: {}&quot;</span>, <span class='ident'>matches</span>.<span class='ident'>value_of</span>(<span class='string'>&quot;config&quot;</span>).<span class='ident'>unwrap</span>());
<span class='comment'>// Although not advised, if you have a required argument</span>
<span class='comment'>// you can call .unwrap() because the program will exit long before</span>
<span class='comment'>// here at noticing the user didn&#39;t supply a required argument...</span>
<span class='comment'>// use at your own risk ;)</span>
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Config file: {}&quot;</span>, <span class='ident'>matches</span>.<span class='ident'>value_of</span>(<span class='string'>&quot;config&quot;</span>).<span class='ident'>unwrap</span>());
<span class='comment'>// You can check the present of an argument</span>
<span class='kw'>if</span> <span class='ident'>matches</span>.<span class='ident'>is_present</span>(<span class='string'>&quot;debug&quot;</span>) {
<span class='comment'>// Checking if &quot;debug&quot; was present was necessary,</span>
<span class='comment'>// as occurrences returns 0 if a flag isn&#39;t found</span>
<span class='comment'>// but we can check how many times &quot;debug&quot; was found</span>
<span class='comment'>// if we allow multiple (if multiple isn&#39;t allowed it always be 1 or 0)</span>
<span class='kw'>if</span> <span class='ident'>matches</span>.<span class='ident'>occurrences_of</span>(<span class='string'>&quot;debug&quot;</span>) <span class='op'>&gt;</span> <span class='number'>1</span> {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Debug mode is REALLY on&quot;</span>);
} <span class='kw'>else</span> {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Debug mode kind of on&quot;</span>);
}
}
<span class='comment'>// You can check the present of an argument</span>
<span class='kw'>if</span> <span class='ident'>matches</span>.<span class='ident'>is_present</span>(<span class='string'>&quot;debug&quot;</span>) {
<span class='comment'>// Checking if &quot;debug&quot; was present was necessary,</span>
<span class='comment'>// as occurrences returns 0 if a flag isn&#39;t found</span>
<span class='comment'>// but we can check how many times &quot;debug&quot; was found</span>
<span class='comment'>// if we allow multiple (if multiple isn&#39;t allowed it always be 1 or 0)</span>
<span class='kw'>if</span> <span class='ident'>matches</span>.<span class='ident'>occurrences_of</span>(<span class='string'>&quot;debug&quot;</span>) <span class='op'>&gt;</span> <span class='number'>1</span> {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Debug mode is REALLY on&quot;</span>);
} <span class='kw'>else</span> {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Debug mode kind of on&quot;</span>);
}
}
<span class='comment'>// You can get the sub-matches of a particular subcommand (in this case &quot;test&quot;)</span>
<span class='comment'>// If &quot;test&quot; had it&#39;s own &quot;-l&quot; flag you could check for it&#39;s presence accordingly</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'>matches</span>) <span class='op'>=</span> <span class='ident'>matches</span>.<span class='ident'>subcommand_matches</span>(<span class='string'>&quot;test&quot;</span>) {
<span class='kw'>if</span> <span class='ident'>matches</span>.<span class='ident'>is_present</span>(<span class='string'>&quot;list&quot;</span>) {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Printing testing lists...&quot;</span>);
} <span class='kw'>else</span> {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Not printing testing lists...&quot;</span>);
}
<span class='comment'>// You can get the sub-matches of a particular subcommand (in this case &quot;test&quot;)</span>
<span class='comment'>// If &quot;test&quot; had it&#39;s own &quot;-l&quot; flag you could check for it&#39;s presence accordingly</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'>matches</span>) <span class='op'>=</span> <span class='ident'>matches</span>.<span class='ident'>subcommand_matches</span>(<span class='string'>&quot;test&quot;</span>) {
<span class='kw'>if</span> <span class='ident'>matches</span>.<span class='ident'>is_present</span>(<span class='string'>&quot;list&quot;</span>) {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Printing testing lists...&quot;</span>);
} <span class='kw'>else</span> {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Not printing testing lists...&quot;</span>);
}
}
</pre>
@ -157,7 +156,7 @@ at all.</p>
<h1 id="example" class='section-header'><a
href="#example">Example</a></h1><pre id='rust-example-rendered' class='rust '>
<span class='kw'>match</span> <span class='ident'>app_matches</span>.<span class='ident'>subcommand_</span>() {
<span class='kw'>match</span> <span class='ident'>app_matches</span>.<span class='ident'>subcommand_name</span>() {
<span class='prelude-val'>Some</span>(<span class='string'>&quot;test&quot;</span>) <span class='op'>=&gt;</span> {}, <span class='comment'>// test was used</span>
<span class='prelude-val'>Some</span>(<span class='string'>&quot;config&quot;</span>) <span class='op'>=&gt;</span> {}, <span class='comment'>// config was used</span>
_ <span class='op'>=&gt;</span> {}, <span class='comment'>// Either no subcommand or one not tested for...</span>

View file

@ -247,7 +247,6 @@
<span id="205">205</span>
<span id="206">206</span>
<span id="207">207</span>
<span id="208">208</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>;
@ -265,7 +264,7 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg};</span>
<span class='doccomment'>/// let matches = App::new(&quot;MyApp&quot;)</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>
<span class='doccomment'>/// # .long(&quot;config&quot;)</span>
@ -275,38 +274,37 @@
<span class='doccomment'>/// # .short(&quot;d&quot;)</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>
<span class='doccomment'>/// println!(&quot;Value for output: {}&quot;, o);</span>
<span class='doccomment'>/// }</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>
<span class='doccomment'>/// println!(&quot;Value for output: {}&quot;, o);</span>
<span class='doccomment'>/// }</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// // Although not advised, if you have a required argument</span>
<span class='doccomment'>/// // you can call .unwrap() because the program will exit long before</span>
<span class='doccomment'>/// // here at noticing the user didn&#39;t supply a required argument...</span>
<span class='doccomment'>/// // use at your own risk ;)</span>
<span class='doccomment'>/// println!(&quot;Config file: {}&quot;, matches.value_of(&quot;config&quot;).unwrap());</span>
<span class='doccomment'>/// // Although not advised, if you have a required argument</span>
<span class='doccomment'>/// // you can call .unwrap() because the program will exit long before</span>
<span class='doccomment'>/// // here at noticing the user didn&#39;t supply a required argument...</span>
<span class='doccomment'>/// // use at your own risk ;)</span>
<span class='doccomment'>/// println!(&quot;Config file: {}&quot;, matches.value_of(&quot;config&quot;).unwrap());</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// // You can check the present of an argument</span>
<span class='doccomment'>/// if matches.is_present(&quot;debug&quot;) {</span>
<span class='doccomment'>/// // Checking if &quot;debug&quot; was present was necessary,</span>
<span class='doccomment'>/// // as occurrences returns 0 if a flag isn&#39;t found</span>
<span class='doccomment'>/// // but we can check how many times &quot;debug&quot; was found</span>
<span class='doccomment'>/// // if we allow multiple (if multiple isn&#39;t allowed it always be 1 or 0)</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>
<span class='doccomment'>/// println!(&quot;Debug mode kind of on&quot;);</span>
<span class='doccomment'>/// }</span>
<span class='doccomment'>/// }</span>
<span class='doccomment'>/// // You can check the present of an argument</span>
<span class='doccomment'>/// if matches.is_present(&quot;debug&quot;) {</span>
<span class='doccomment'>/// // Checking if &quot;debug&quot; was present was necessary,</span>
<span class='doccomment'>/// // as occurrences returns 0 if a flag isn&#39;t found</span>
<span class='doccomment'>/// // but we can check how many times &quot;debug&quot; was found</span>
<span class='doccomment'>/// // if we allow multiple (if multiple isn&#39;t allowed it always be 1 or 0)</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>
<span class='doccomment'>/// println!(&quot;Debug mode kind of on&quot;);</span>
<span class='doccomment'>/// }</span>
<span class='doccomment'>/// }</span>
<span class='doccomment'>///</span>
<span class='doccomment'>/// // You can get the sub-matches of a particular subcommand (in this case &quot;test&quot;)</span>
<span class='doccomment'>/// // If &quot;test&quot; had it&#39;s own &quot;-l&quot; flag you could check for it&#39;s presence accordingly</span>
<span class='doccomment'>/// if let Some(ref matches) = matches.subcommand_matches(&quot;test&quot;) {</span>
<span class='doccomment'>/// if matches.is_present(&quot;list&quot;) {</span>
<span class='doccomment'>/// println!(&quot;Printing testing lists...&quot;);</span>
<span class='doccomment'>/// } else {</span>
<span class='doccomment'>/// println!(&quot;Not printing testing lists...&quot;);</span>
<span class='doccomment'>/// }</span>
<span class='doccomment'>/// // You can get the sub-matches of a particular subcommand (in this case &quot;test&quot;)</span>
<span class='doccomment'>/// // If &quot;test&quot; had it&#39;s own &quot;-l&quot; flag you could check for it&#39;s presence accordingly</span>
<span class='doccomment'>/// if let Some(ref matches) = matches.subcommand_matches(&quot;test&quot;) {</span>
<span class='doccomment'>/// if matches.is_present(&quot;list&quot;) {</span>
<span class='doccomment'>/// println!(&quot;Printing testing lists...&quot;);</span>
<span class='doccomment'>/// } else {</span>
<span class='doccomment'>/// println!(&quot;Not printing testing lists...&quot;);</span>
<span class='doccomment'>/// }</span>
<span class='doccomment'>/// }</span>
<span class='kw'>pub</span> <span class='kw'>struct</span> <span class='ident'>ArgMatches</span> {
@ -423,7 +421,7 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg, SubCommand};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myapp&quot;).subcommand(SubCommand::new(&quot;test&quot;)).get_matches();</span>
<span class='doccomment'>/// # let app_matches = App::new(&quot;myapp&quot;).subcommand(SubCommand::new(&quot;test&quot;)).get_matches();</span>
<span class='doccomment'>/// if let Some(matches) = app_matches.subcommand_matches(&quot;test&quot;) {</span>
<span class='doccomment'>/// // Use matches as normal</span>
<span class='doccomment'>/// }</span>
@ -443,8 +441,8 @@
<span class='doccomment'>///</span>
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg, SubCommand};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myapp&quot;).subcommand(SubCommand::new(&quot;test&quot;)).get_matches();</span>
<span class='doccomment'>/// match app_matches.subcommand_() {</span>
<span class='doccomment'>/// # let app_matches = App::new(&quot;myapp&quot;).subcommand(SubCommand::new(&quot;test&quot;)).get_matches();</span>
<span class='doccomment'>/// match app_matches.subcommand_name() {</span>
<span class='doccomment'>/// Some(&quot;test&quot;) =&gt; {}, // test was used</span>
<span class='doccomment'>/// Some(&quot;config&quot;) =&gt; {}, // config was used</span>
<span class='doccomment'>/// _ =&gt; {}, // Either no subcommand or one not tested for...</span>

View file

@ -215,7 +215,7 @@
<span class='doccomment'>//! Example:</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ```no_run</span>
<span class='doccomment'>//! use clap::{Arg, App};</span>
<span class='doccomment'>//! use clap::{Arg, App, SubCommand};</span>
<span class='doccomment'>//!</span>
<span class='doccomment'>//! // ...</span>
<span class='doccomment'>//! </span>
@ -235,7 +235,7 @@
<span class='doccomment'>//! .short(&quot;d&quot;)</span>
<span class='doccomment'>//! .multiple(true)</span>
<span class='doccomment'>//! .help(&quot;Turn debugging information on&quot;))</span>
<span class='doccomment'>//! .subcomamnd(SubCommand::new(&quot;test&quot;)</span>
<span class='doccomment'>//! .subcommand(SubCommand::new(&quot;test&quot;)</span>
<span class='doccomment'>//! .about(&quot;Has test sub functionality&quot;)</span>
<span class='doccomment'>//! .arg(Arg::new(&quot;verbose&quot;)</span>
<span class='doccomment'>//! .short(&quot;v&quot;)</span>

View file

@ -99,7 +99,7 @@
<span class='doccomment'>/// ```no_run</span>
<span class='doccomment'>/// # use clap::{App, Arg, SubCommand};</span>
<span class='doccomment'>/// # let matches = App::new(&quot;myprog&quot;)</span>
<span class='doccomment'>/// # .SubCommand(</span>
<span class='doccomment'>/// # .subcommand(</span>
<span class='doccomment'>/// SubCommand::new(&quot;conifg&quot;)</span>
<span class='doccomment'>/// .about(&quot;Used for configuration&quot;)</span>
<span class='doccomment'>/// .arg(Arg::new(&quot;config_file&quot;)</span>