Fixed doc error

This commit is contained in:
Kevin K 2015-03-22 22:13:10 -04:00
parent b22cda47a4
commit 66dab46760
3 changed files with 1 additions and 566 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-301'>[src]</a></span></h1>
</span><a id='src-0' href='../src/clap/lib.rs.html#1-159'>[src]</a></span></h1>
<div class='docblock'>
<h1 id="clap" class='section-header'><a
href="#clap">clap</a></h1>
@ -183,145 +183,6 @@ SUBCOMMANDS:
<pre id='rust-example-rendered' class='rust '>
<span class='ident'>make</span> <span class='ident'>doc</span>
</pre>
<h1 id="clap-1" class='section-header'><a
href="#clap-1">clap</a></h1>
<p><img src="https://travis-ci.org/kbknapp/clap-rs.svg?branch=master" alt="Travis-CI"></p>
<p>Command Line Argument Parser written in Rust</p>
<p>A simply library for parsing command line arguments and subcommands when writing command line and console applications.</p>
<p>You can use <code>clap</code> to lay out a list of possible valid command line arguments and subcommands, then let <code>clap</code> parse the string given by the user at runtime.</p>
<p>When using <code>clap</code> you define a set of parameters and rules for your arguments and subcommands, then at runtime <code>clap</code> will determine their validity.</p>
<p><code>clap</code> also provides the traditional version and help switches &#39;for free&#39; by parsing the list of possible valid arguments lazily at runtime, and if not already defined by the developer <code>clap</code> will autogenerate all applicable &quot;help&quot; and &quot;version&quot; switches (as well as a &quot;help&quot; subcommand if other subcommands are defined as well).</p>
<p>After defining a list of possible valid arguments and subcommands, <code>clap</code> gives you a list of valid matches that the user supplied at runtime, or informs the user of their error and exits gracefully. You can use this list to determine the functioning of your program.</p>
<h2 id="quick-example-1" class='section-header'><a
href="#quick-example-1">Quick Example</a></h2><pre id='rust-example-rendered' class='rust '>
<span class='comment'>// (Full example with comments in examples/01_QuickExample.rs)</span>
<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='ident'>SubCommand</span>};
<span class='kw'>fn</span> <span class='ident'>main</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='ident'>version</span>(<span class='string'>&quot;1.0&quot;</span>)
.<span class='ident'>author</span>(<span class='string'>&quot;Kevin K. &lt;kbknapp@gmail.com&gt;&quot;</span>)
.<span class='ident'>about</span>(<span class='string'>&quot;Does awesome things&quot;</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='ident'>long</span>(<span class='string'>&quot;config&quot;</span>)
.<span class='ident'>help</span>(<span class='string'>&quot;Sets a custom config file&quot;</span>)
.<span class='ident'>takes_value</span>(<span class='boolval'>true</span>))
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;output&quot;</span>)
.<span class='ident'>help</span>(<span class='string'>&quot;Sets an optional output file&quot;</span>)
.<span class='ident'>index</span>(<span class='number'>1</span>))
.<span class='ident'>arg</span>(<span class='ident'>Arg</span>::<span class='ident'>new</span>(<span class='string'>&quot;debug&quot;</span>)
.<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'>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;controls testing features&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>)
.<span class='ident'>help</span>(<span class='string'>&quot;print test information verbosely&quot;</span>)))
.<span class='ident'>get_matches</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='kw'>if</span> <span class='kw'>let</span> <span class='prelude-val'>Some</span>(<span class='ident'>c</span>) <span class='op'>=</span> <span class='ident'>matches</span>.<span class='ident'>value_of</span>(<span class='string'>&quot;config&quot;</span>) {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Value for config: {}&quot;</span>, <span class='ident'>c</span>);
}
<span class='kw'>match</span> <span class='ident'>matches</span>.<span class='ident'>occurrences_of</span>(<span class='string'>&quot;debug&quot;</span>) {
<span class='number'>0</span> <span class='op'>=&gt;</span> <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Debug mode is off&quot;</span>),
<span class='number'>1</span> <span class='op'>=&gt;</span> <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Debug mode is kind of on&quot;</span>),
<span class='number'>2</span> <span class='op'>=&gt;</span> <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Debug mode is on&quot;</span>),
<span class='number'>3</span> <span class='op'>|</span> _ <span class='op'>=&gt;</span> <span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Don&#39;t be crazy&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'>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;verbose&quot;</span>) {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Printing verbosely...&quot;</span>);
} <span class='kw'>else</span> {
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;Printing normally...&quot;</span>);
}
}
<span class='comment'>// more porgram logic goes here...</span>
}
</pre>
<p>If you were to compile the above program and run it with the flag <code>--help</code> or <code>-h</code> (or <code>help</code> subcommand, since we defined <code>test</code> as a subcommand) the following output woud be presented</p>
<pre><code class="language-sh">$ myprog --help
MyApp 1.0
Kevin K. &lt;kbknapp@gmail.com&gt;
Does awesome things
USAGE:
MyApp [FLAGS] [OPTIONS] [POSITIONAL] [SUBCOMMANDS]
FLAGS:
-d Turn debugging information on
-h,--help Prints this message
-v,--version Prints version information
OPTIONS:
-c,--config &lt;config&gt; Sets a custom config file
POSITIONAL ARGUMENTS:
output Sets an optional output file
SUBCOMMANDS:
help Prints this message
test Controls testing features
</code></pre>
<h2 id="installation-1" class='section-header'><a
href="#installation-1">Installation</a></h2>
<p>Add <code>clap</code> as a dependecy in your <code>Cargo.toml</code> file to use from crates.io:</p>
<pre id='rust-example-rendered' class='rust '>
[<span class='ident'>dependencies</span>]
<span class='ident'>clap</span> <span class='op'>=</span> <span class='string'>&quot;*&quot;</span>
</pre>
<p>Or track the latest on the master branch at github:</p>
<pre id='rust-example-rendered' class='rust '>
[<span class='ident'>dependencies</span>.<span class='ident'>clap</span>]
<span class='ident'>git</span> <span class='op'>=</span> <span class='string'>&quot;https://github.com/kbknapp/clap-rs.git&quot;</span>
</pre>
<p>Then run <code>cargo build</code> or <code>cargo update</code> for your project.</p>
<h2 id="usage-1" class='section-header'><a
href="#usage-1">Usage</a></h2>
<p>Add <code>extern crate clap;</code> to your crate root.</p>
<h2 id="more-information-1" class='section-header'><a
href="#more-information-1">More Information</a></h2>
<p>You can find complete documentation on the <a href="http://kbknapp.github.io/clap-rs/docs/clap/index.html">github-pages site</a> for this project.</p>
<p>You can also find full usage examples in the examples/ directory of this repo.</p>
<h2 id="how-to-build-1" class='section-header'><a
href="#how-to-build-1">How to build</a></h2>
<h3 id="running-the-tests-1" class='section-header'><a
href="#running-the-tests-1">Running the tests</a></h3><pre id='rust-example-rendered' class='rust '>
<span class='ident'>cargo</span> <span class='ident'>test</span>
</pre>
<h3 id="building-the-documentation-1" class='section-header'><a
href="#building-the-documentation-1">Building the documentation</a></h3>
<p>Run this instead of <code>cargo doc</code> to generate the proper module docstring:</p>
<pre id='rust-example-rendered' class='rust '>
<span class='ident'>make</span> <span class='ident'>doc</span>
</pre>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
<tr>

View file

@ -199,148 +199,6 @@
<span id="157">157</span>
<span id="158">158</span>
<span id="159">159</span>
<span id="160">160</span>
<span id="161">161</span>
<span id="162">162</span>
<span id="163">163</span>
<span id="164">164</span>
<span id="165">165</span>
<span id="166">166</span>
<span id="167">167</span>
<span id="168">168</span>
<span id="169">169</span>
<span id="170">170</span>
<span id="171">171</span>
<span id="172">172</span>
<span id="173">173</span>
<span id="174">174</span>
<span id="175">175</span>
<span id="176">176</span>
<span id="177">177</span>
<span id="178">178</span>
<span id="179">179</span>
<span id="180">180</span>
<span id="181">181</span>
<span id="182">182</span>
<span id="183">183</span>
<span id="184">184</span>
<span id="185">185</span>
<span id="186">186</span>
<span id="187">187</span>
<span id="188">188</span>
<span id="189">189</span>
<span id="190">190</span>
<span id="191">191</span>
<span id="192">192</span>
<span id="193">193</span>
<span id="194">194</span>
<span id="195">195</span>
<span id="196">196</span>
<span id="197">197</span>
<span id="198">198</span>
<span id="199">199</span>
<span id="200">200</span>
<span id="201">201</span>
<span id="202">202</span>
<span id="203">203</span>
<span id="204">204</span>
<span id="205">205</span>
<span id="206">206</span>
<span id="207">207</span>
<span id="208">208</span>
<span id="209">209</span>
<span id="210">210</span>
<span id="211">211</span>
<span id="212">212</span>
<span id="213">213</span>
<span id="214">214</span>
<span id="215">215</span>
<span id="216">216</span>
<span id="217">217</span>
<span id="218">218</span>
<span id="219">219</span>
<span id="220">220</span>
<span id="221">221</span>
<span id="222">222</span>
<span id="223">223</span>
<span id="224">224</span>
<span id="225">225</span>
<span id="226">226</span>
<span id="227">227</span>
<span id="228">228</span>
<span id="229">229</span>
<span id="230">230</span>
<span id="231">231</span>
<span id="232">232</span>
<span id="233">233</span>
<span id="234">234</span>
<span id="235">235</span>
<span id="236">236</span>
<span id="237">237</span>
<span id="238">238</span>
<span id="239">239</span>
<span id="240">240</span>
<span id="241">241</span>
<span id="242">242</span>
<span id="243">243</span>
<span id="244">244</span>
<span id="245">245</span>
<span id="246">246</span>
<span id="247">247</span>
<span id="248">248</span>
<span id="249">249</span>
<span id="250">250</span>
<span id="251">251</span>
<span id="252">252</span>
<span id="253">253</span>
<span id="254">254</span>
<span id="255">255</span>
<span id="256">256</span>
<span id="257">257</span>
<span id="258">258</span>
<span id="259">259</span>
<span id="260">260</span>
<span id="261">261</span>
<span id="262">262</span>
<span id="263">263</span>
<span id="264">264</span>
<span id="265">265</span>
<span id="266">266</span>
<span id="267">267</span>
<span id="268">268</span>
<span id="269">269</span>
<span id="270">270</span>
<span id="271">271</span>
<span id="272">272</span>
<span id="273">273</span>
<span id="274">274</span>
<span id="275">275</span>
<span id="276">276</span>
<span id="277">277</span>
<span id="278">278</span>
<span id="279">279</span>
<span id="280">280</span>
<span id="281">281</span>
<span id="282">282</span>
<span id="283">283</span>
<span id="284">284</span>
<span id="285">285</span>
<span id="286">286</span>
<span id="287">287</span>
<span id="288">288</span>
<span id="289">289</span>
<span id="290">290</span>
<span id="291">291</span>
<span id="292">292</span>
<span id="293">293</span>
<span id="294">294</span>
<span id="295">295</span>
<span id="296">296</span>
<span id="297">297</span>
<span id="298">298</span>
<span id="299">299</span>
<span id="300">300</span>
<span id="301">301</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>
@ -490,148 +348,6 @@
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! make doc</span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! # clap</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ![Travis-CI](https://travis-ci.org/kbknapp/clap-rs.svg?branch=master)</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! Command Line Argument Parser written in Rust</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! A simply library for parsing command line arguments and subcommands when writing command line and console applications.</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! You can use `clap` to lay out a list of possible valid command line arguments and subcommands, then let `clap` parse the string given by the user at runtime.</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! When using `clap` you define a set of parameters and rules for your arguments and subcommands, then at runtime `clap` will determine their validity.</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! `clap` also provides the traditional version and help switches &#39;for free&#39; by parsing the list of possible valid arguments lazily at runtime, and if not already defined by the developer `clap` will autogenerate all applicable &quot;help&quot; and &quot;version&quot; switches (as well as a &quot;help&quot; subcommand if other subcommands are defined as well).</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! After defining a list of possible valid arguments and subcommands, `clap` gives you a list of valid matches that the user supplied at runtime, or informs the user of their error and exits gracefully. You can use this list to determine the functioning of your program.</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ## Quick Example</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ```rust</span>
<span class='doccomment'>//! // (Full example with comments in examples/01_QuickExample.rs)</span>
<span class='doccomment'>//! extern crate clap;</span>
<span class='doccomment'>//! use clap::{Arg, App, SubCommand};</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! fn main() {</span>
<span class='doccomment'>//! let matches = App::new(&quot;MyApp&quot;)</span>
<span class='doccomment'>//! .version(&quot;1.0&quot;)</span>
<span class='doccomment'>//! .author(&quot;Kevin K. &lt;kbknapp@gmail.com&gt;&quot;)</span>
<span class='doccomment'>//! .about(&quot;Does awesome things&quot;)</span>
<span class='doccomment'>//! .arg(Arg::new(&quot;config&quot;)</span>
<span class='doccomment'>//! .short(&quot;c&quot;)</span>
<span class='doccomment'>//! .long(&quot;config&quot;)</span>
<span class='doccomment'>//! .help(&quot;Sets a custom config file&quot;)</span>
<span class='doccomment'>//! .takes_value(true))</span>
<span class='doccomment'>//! .arg(Arg::new(&quot;output&quot;)</span>
<span class='doccomment'>//! .help(&quot;Sets an optional output file&quot;)</span>
<span class='doccomment'>//! .index(1))</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'>//! .help(&quot;Turn debugging information on&quot;))</span>
<span class='doccomment'>//! .subcommand(SubCommand::new(&quot;test&quot;)</span>
<span class='doccomment'>//! .about(&quot;controls testing features&quot;)</span>
<span class='doccomment'>//! .arg(Arg::new(&quot;verbose&quot;)</span>
<span class='doccomment'>//! .short(&quot;v&quot;)</span>
<span class='doccomment'>//! .help(&quot;print test information verbosely&quot;)))</span>
<span class='doccomment'>//! .get_matches();</span>
<span class='doccomment'>//! </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'>//! if let Some(c) = matches.value_of(&quot;config&quot;) {</span>
<span class='doccomment'>//! println!(&quot;Value for config: {}&quot;, c);</span>
<span class='doccomment'>//! }</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! match matches.occurrences_of(&quot;debug&quot;) {</span>
<span class='doccomment'>//! 0 =&gt; println!(&quot;Debug mode is off&quot;),</span>
<span class='doccomment'>//! 1 =&gt; println!(&quot;Debug mode is kind of on&quot;),</span>
<span class='doccomment'>//! 2 =&gt; println!(&quot;Debug mode is on&quot;),</span>
<span class='doccomment'>//! 3 | _ =&gt; println!(&quot;Don&#39;t be crazy&quot;),</span>
<span class='doccomment'>//! }</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! if let Some(ref matches) = matches.subcommand_matches(&quot;test&quot;) {</span>
<span class='doccomment'>//! if matches.is_present(&quot;verbose&quot;) {</span>
<span class='doccomment'>//! println!(&quot;Printing verbosely...&quot;);</span>
<span class='doccomment'>//! } else {</span>
<span class='doccomment'>//! println!(&quot;Printing normally...&quot;);</span>
<span class='doccomment'>//! }</span>
<span class='doccomment'>//! }</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! // more porgram logic goes here...</span>
<span class='doccomment'>//! }</span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! If you were to compile the above program and run it with the flag `--help` or `-h` (or `help` subcommand, since we defined `test` as a subcommand) the following output woud be presented</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ```sh</span>
<span class='doccomment'>//! $ myprog --help</span>
<span class='doccomment'>//! MyApp 1.0</span>
<span class='doccomment'>//! Kevin K. &lt;kbknapp@gmail.com&gt;</span>
<span class='doccomment'>//! Does awesome things</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! USAGE:</span>
<span class='doccomment'>//! MyApp [FLAGS] [OPTIONS] [POSITIONAL] [SUBCOMMANDS]</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! FLAGS:</span>
<span class='doccomment'>//! -d Turn debugging information on</span>
<span class='doccomment'>//! -h,--help Prints this message</span>
<span class='doccomment'>//! -v,--version Prints version information</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! OPTIONS:</span>
<span class='doccomment'>//! -c,--config &lt;config&gt; Sets a custom config file</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! POSITIONAL ARGUMENTS:</span>
<span class='doccomment'>//! output Sets an optional output file</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! SUBCOMMANDS:</span>
<span class='doccomment'>//! help Prints this message</span>
<span class='doccomment'>//! test Controls testing features</span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ## Installation</span>
<span class='doccomment'>//! Add `clap` as a dependecy in your `Cargo.toml` file to use from crates.io:</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! [dependencies]</span>
<span class='doccomment'>//! clap = &quot;*&quot;</span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! Or track the latest on the master branch at github:</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! [dependencies.clap]</span>
<span class='doccomment'>//! git = &quot;https://github.com/kbknapp/clap-rs.git&quot;</span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! Then run `cargo build` or `cargo update` for your project.</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ## Usage</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! Add `extern crate clap;` to your crate root.</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ## More Information</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! You can find complete documentation on the [github-pages site](http://kbknapp.github.io/clap-rs/docs/clap/index.html) for this project.</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! You can also find full usage examples in the examples/ directory of this repo.</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ## How to build</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ### Running the tests</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! cargo test</span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ### Building the documentation</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! Run this instead of `cargo doc` to generate the proper module docstring:</span>
<span class='doccomment'>//! </span>
<span class='doccomment'>//! ```</span>
<span class='doccomment'>//! make doc</span>
<span class='doccomment'>//! ```</span>
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>args</span>::{<span class='ident'>Arg</span>, <span class='ident'>SubCommand</span>, <span class='ident'>ArgMatches</span>};
<span class='kw'>pub</span> <span class='kw'>use</span> <span class='ident'>app</span>::<span class='ident'>App</span>;

View file

@ -4,148 +4,6 @@
#![feature(exit_status)]
// DOCS
//! # clap
//!
//! ![Travis-CI](https://travis-ci.org/kbknapp/clap-rs.svg?branch=master)
//!
//! Command Line Argument Parser written in Rust
//!
//! A simply library for parsing command line arguments and subcommands when writing command line and console applications.
//!
//! You can use `clap` to lay out a list of possible valid command line arguments and subcommands, then let `clap` parse the string given by the user at runtime.
//!
//! When using `clap` you define a set of parameters and rules for your arguments and subcommands, then at runtime `clap` will determine their validity.
//!
//! `clap` also provides the traditional version and help switches 'for free' by parsing the list of possible valid arguments lazily at runtime, and if not already defined by the developer `clap` will autogenerate all applicable "help" and "version" switches (as well as a "help" subcommand if other subcommands are defined as well).
//!
//! After defining a list of possible valid arguments and subcommands, `clap` gives you a list of valid matches that the user supplied at runtime, or informs the user of their error and exits gracefully. You can use this list to determine the functioning of your program.
//!
//! ## Quick Example
//!
//! ```rust
//! // (Full example with comments in examples/01_QuickExample.rs)
//! extern crate clap;
//! use clap::{Arg, App, SubCommand};
//!
//! fn main() {
//! let matches = App::new("MyApp")
//! .version("1.0")
//! .author("Kevin K. <kbknapp@gmail.com>")
//! .about("Does awesome things")
//! .arg(Arg::new("config")
//! .short("c")
//! .long("config")
//! .help("Sets a custom config file")
//! .takes_value(true))
//! .arg(Arg::new("output")
//! .help("Sets an optional output file")
//! .index(1))
//! .arg(Arg::new("debug")
//! .short("d")
//! .multiple(true)
//! .help("Turn debugging information on"))
//! .subcommand(SubCommand::new("test")
//! .about("controls testing features")
//! .arg(Arg::new("verbose")
//! .short("v")
//! .help("print test information verbosely")))
//! .get_matches();
//!
//! if let Some(o) = matches.value_of("output") {
//! println!("Value for output: {}", o);
//! }
//!
//! if let Some(c) = matches.value_of("config") {
//! println!("Value for config: {}", c);
//! }
//!
//! match matches.occurrences_of("debug") {
//! 0 => println!("Debug mode is off"),
//! 1 => println!("Debug mode is kind of on"),
//! 2 => println!("Debug mode is on"),
//! 3 | _ => println!("Don't be crazy"),
//! }
//!
//! if let Some(ref matches) = matches.subcommand_matches("test") {
//! if matches.is_present("verbose") {
//! println!("Printing verbosely...");
//! } else {
//! println!("Printing normally...");
//! }
//! }
//!
//! // more porgram logic goes here...
//! }
//! ```
//!
//! If you were to compile the above program and run it with the flag `--help` or `-h` (or `help` subcommand, since we defined `test` as a subcommand) the following output woud be presented
//!
//! ```sh
//! $ myprog --help
//! MyApp 1.0
//! Kevin K. <kbknapp@gmail.com>
//! Does awesome things
//!
//! USAGE:
//! MyApp [FLAGS] [OPTIONS] [POSITIONAL] [SUBCOMMANDS]
//!
//! FLAGS:
//! -d Turn debugging information on
//! -h,--help Prints this message
//! -v,--version Prints version information
//!
//! OPTIONS:
//! -c,--config <config> Sets a custom config file
//!
//! POSITIONAL ARGUMENTS:
//! output Sets an optional output file
//!
//! SUBCOMMANDS:
//! help Prints this message
//! test Controls testing features
//! ```
//!
//! ## Installation
//! Add `clap` as a dependecy in your `Cargo.toml` file to use from crates.io:
//!
//! ```
//! [dependencies]
//! clap = "*"
//! ```
//! Or track the latest on the master branch at github:
//!
//! ```
//! [dependencies.clap]
//! git = "https://github.com/kbknapp/clap-rs.git"
//! ```
//!
//! Then run `cargo build` or `cargo update` for your project.
//!
//! ## Usage
//!
//! Add `extern crate clap;` to your crate root.
//!
//! ## More Information
//!
//! You can find complete documentation on the [github-pages site](http://kbknapp.github.io/clap-rs/docs/clap/index.html) for this project.
//!
//! You can also find full usage examples in the examples/ directory of this repo.
//!
//! ## How to build
//!
//! ### Running the tests
//!
//! ```
//! cargo test
//! ```
//!
//! ### Building the documentation
//!
//! Run this instead of `cargo doc` to generate the proper module docstring:
//!
//! ```
//! make doc
//! ```
pub use args::{Arg, SubCommand, ArgMatches};
pub use app::App;