Removed unneeded fields from Arg Matches

This commit is contained in:
Kevin K 2015-03-03 13:10:19 -05:00
parent b7975ec8b6
commit 62704caf8d
7 changed files with 30 additions and 35 deletions

2
Cargo.lock generated
View file

@ -1,4 +1,4 @@
[root]
name = "clap"
version = "0.3.5"
version = "0.3.6"

View file

@ -1,7 +1,7 @@
[package]
name = "clap"
version = "0.3.5"
version = "0.3.6"
authors = ["Kevin K. <kbknapp@gmail.com>"]
exclude = ["docs/*"]
description = "A Command Line Argument Parser written in Rust"

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#21-53'>[src]</a></span></h1>
</span><a id='src-4414' 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,14 +43,9 @@
<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#49-59'>[src]</a></span></h1>
</span><a id='src-4244' 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;,
pub about: <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 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 version: <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 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;,
pub opts: <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>, OptArg&gt;,
pub positionals: <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>, PosArg&gt;,
@ -88,7 +83,7 @@ the methods in order to query information.</p>
}
</pre>
</div><h2 class='fields'>Fields</h2>
<table><tr><td id='structfield.required'><a class='stability Unmarked' title='No stability level'></a><code>required</code></td><td></td></tr><tr><td id='structfield.blacklist'><a class='stability Unmarked' title='No stability level'></a><code>blacklist</code></td><td></td></tr><tr><td id='structfield.about'><a class='stability Unmarked' title='No stability level'></a><code>about</code></td><td></td></tr><tr><td id='structfield.name'><a class='stability Unmarked' title='No stability level'></a><code>name</code></td><td></td></tr><tr><td id='structfield.author'><a class='stability Unmarked' title='No stability level'></a><code>author</code></td><td></td></tr><tr><td id='structfield.version'><a class='stability Unmarked' title='No stability level'></a><code>version</code></td><td></td></tr><tr><td id='structfield.flags'><a class='stability Unmarked' title='No stability level'></a><code>flags</code></td><td></td></tr><tr><td id='structfield.opts'><a class='stability Unmarked' title='No stability level'></a><code>opts</code></td><td></td></tr><tr><td id='structfield.positionals'><a class='stability Unmarked' title='No stability level'></a><code>positionals</code></td><td></td></tr></table><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a></code></h3><div class='impl-items'><h4 id='method.new' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.new' class='fnname'>new</a>(app: &amp;<a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>) -&gt; <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a></code></h4>
<table><tr><td id='structfield.name'><a class='stability Unmarked' title='No stability level'></a><code>name</code></td><td></td></tr><tr><td id='structfield.flags'><a class='stability Unmarked' title='No stability level'></a><code>flags</code></td><td></td></tr><tr><td id='structfield.opts'><a class='stability Unmarked' title='No stability level'></a><code>opts</code></td><td></td></tr><tr><td id='structfield.positionals'><a class='stability Unmarked' title='No stability level'></a><code>positionals</code></td><td></td></tr></table><h2 id='methods'>Methods</h2><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a></code></h3><div class='impl-items'><h4 id='method.new' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.new' class='fnname'>new</a>(app: &amp;<a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>) -&gt; <a class='struct' href='../clap/struct.ArgMatches.html' title='clap::ArgMatches'>ArgMatches</a></code></h4>
<div class='docblock'><p>Creates a new instance of <code>ArgMatches</code>. This ins&#39;t called directly, but
through the <code>.get_matches()</code> method of <code>App</code></p>

File diff suppressed because one or more lines are too long

View file

@ -200,7 +200,7 @@
<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>;
<span class='comment'>// use std::collections::HashSet;</span>
<span class='kw'>use</span> <span class='ident'>app</span>::<span class='ident'>App</span>;
<span class='kw'>use</span> <span class='ident'>args</span>::{ <span class='ident'>FlagArg</span>, <span class='ident'>OptArg</span>, <span class='ident'>PosArg</span> };
@ -248,12 +248,12 @@
<span class='doccomment'>/// }</span>
<span class='doccomment'>/// }</span>
<span class='kw'>pub</span> <span class='kw'>struct</span> <span class='ident'>ArgMatches</span> {
<span class='kw'>pub</span> <span class='ident'>required</span>: <span class='ident'>Vec</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='kw'>pub</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='kw'>pub</span> <span class='ident'>about</span>: <span class='prelude-ty'>Option</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='kw'>pub</span> <span class='ident'>name</span>: <span class='kw-2'>&amp;</span><span class='lifetime'>&#39;static</span> <span class='ident'>str</span>,
<span class='kw'>pub</span> <span class='ident'>author</span>: <span class='prelude-ty'>Option</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='kw'>pub</span> <span class='ident'>version</span>: <span class='prelude-ty'>Option</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='comment'>// pub author: Option&lt;&amp;&#39;static str&gt;,</span>
<span class='comment'>// pub about: Option&lt;&amp;&#39;static str&gt;,</span>
<span class='comment'>// pub version: Option&lt;&amp;&#39;static str&gt;,</span>
<span class='comment'>// pub required: Vec&lt;&amp;&#39;static str&gt;,</span>
<span class='comment'>// pub blacklist: HashSet&lt;&amp;&#39;static str&gt;,</span>
<span class='kw'>pub</span> <span class='ident'>flags</span>: <span class='ident'>HashMap</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='ident'>FlagArg</span><span class='op'>&gt;</span>,
<span class='kw'>pub</span> <span class='ident'>opts</span>: <span class='ident'>HashMap</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='ident'>OptArg</span><span class='op'>&gt;</span>,
<span class='kw'>pub</span> <span class='ident'>positionals</span>: <span class='ident'>HashMap</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='ident'>PosArg</span><span class='op'>&gt;</span>,
@ -271,15 +271,15 @@
<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> {
<span class='ident'>ArgMatches</span> {
<span class='ident'>name</span>: <span class='ident'>app</span>.<span class='ident'>name</span>,
<span class='ident'>flags</span>: <span class='ident'>HashMap</span>::<span class='ident'>new</span>(),
<span class='ident'>opts</span>: <span class='ident'>HashMap</span>::<span class='ident'>new</span>(),
<span class='ident'>positionals</span>: <span class='ident'>HashMap</span>::<span class='ident'>new</span>(),
<span class='ident'>required</span>: <span class='macro'>vec</span><span class='macro'>!</span>[],
<span class='ident'>blacklist</span>: <span class='ident'>HashSet</span>::<span class='ident'>new</span>(),
<span class='ident'>about</span>: <span class='ident'>app</span>.<span class='ident'>about</span>,
<span class='ident'>name</span>: <span class='ident'>app</span>.<span class='ident'>name</span>,
<span class='ident'>author</span>: <span class='ident'>app</span>.<span class='ident'>author</span>,
<span class='ident'>version</span>: <span class='ident'>app</span>.<span class='ident'>version</span>,
<span class='comment'>// required: vec![],</span>
<span class='comment'>// blacklist: HashSet::new(),</span>
<span class='comment'>// about: app.about,</span>
<span class='comment'>// author: app.author,</span>
<span class='comment'>// version: app.version,</span>
}
}

View file

@ -1,5 +1,5 @@
use std::collections::HashMap;
use std::collections::HashSet;
// use std::collections::HashSet;
use app::App;
use args::{ FlagArg, OptArg, PosArg };
@ -47,12 +47,12 @@ use args::{ FlagArg, OptArg, PosArg };
/// }
/// }
pub struct ArgMatches {
pub required: Vec<&'static str>,
pub blacklist: HashSet<&'static str>,
pub about: Option<&'static str>,
pub name: &'static str,
pub author: Option<&'static str>,
pub version: Option<&'static str>,
// pub author: Option<&'static str>,
// pub about: Option<&'static str>,
// pub version: Option<&'static str>,
// pub required: Vec<&'static str>,
// pub blacklist: HashSet<&'static str>,
pub flags: HashMap<&'static str, FlagArg>,
pub opts: HashMap<&'static str, OptArg>,
pub positionals: HashMap<&'static str, PosArg>,
@ -70,15 +70,15 @@ impl ArgMatches {
/// ```
pub fn new(app: &App) -> ArgMatches {
ArgMatches {
name: app.name,
flags: HashMap::new(),
opts: HashMap::new(),
positionals: HashMap::new(),
required: vec![],
blacklist: HashSet::new(),
about: app.about,
name: app.name,
author: app.author,
version: app.version,
// required: vec![],
// blacklist: HashSet::new(),
// about: app.about,
// author: app.author,
// version: app.version,
}
}