mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
Removed unneeded fields from Arg Matches
This commit is contained in:
parent
b7975ec8b6
commit
62704caf8d
7 changed files with 30 additions and 35 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1,4 +1,4 @@
|
|||
[root]
|
||||
name = "clap"
|
||||
version = "0.3.5"
|
||||
version = "0.3.6"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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> <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: &'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><<a href='http://doc.rust-lang.org/nightly/std/primitive.char.html'>char</a>>,
|
||||
|
|
|
@ -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> <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><&'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>,
|
||||
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><&'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>,
|
||||
pub about: <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>,
|
||||
pub name: &'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><&'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>>,
|
||||
pub version: <a class='enum' href='http://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a><&'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><&'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, FlagArg>,
|
||||
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><&'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, OptArg>,
|
||||
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><&'static <a href='http://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>, PosArg>,
|
||||
|
@ -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: &<a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>) -> <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: &<a class='struct' href='../clap/struct.App.html' title='clap::App'>App</a>) -> <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'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
|
@ -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'><</span><span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='ident'>str</span><span class='op'>></span>,
|
||||
<span class='kw'>pub</span> <span class='ident'>blacklist</span>: <span class='ident'>HashSet</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='ident'>str</span><span class='op'>></span>,
|
||||
<span class='kw'>pub</span> <span class='ident'>about</span>: <span class='prelude-ty'>Option</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='ident'>str</span><span class='op'>></span>,
|
||||
<span class='kw'>pub</span> <span class='ident'>name</span>: <span class='kw-2'>&</span><span class='lifetime'>'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'><</span><span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='ident'>str</span><span class='op'>></span>,
|
||||
<span class='kw'>pub</span> <span class='ident'>version</span>: <span class='prelude-ty'>Option</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='ident'>str</span><span class='op'>></span>,
|
||||
<span class='comment'>// pub author: Option<&'static str>,</span>
|
||||
<span class='comment'>// pub about: Option<&'static str>,</span>
|
||||
<span class='comment'>// pub version: Option<&'static str>,</span>
|
||||
<span class='comment'>// pub required: Vec<&'static str>,</span>
|
||||
<span class='comment'>// pub blacklist: HashSet<&'static str>,</span>
|
||||
<span class='kw'>pub</span> <span class='ident'>flags</span>: <span class='ident'>HashMap</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='ident'>str</span>, <span class='ident'>FlagArg</span><span class='op'>></span>,
|
||||
<span class='kw'>pub</span> <span class='ident'>opts</span>: <span class='ident'>HashMap</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='ident'>str</span>, <span class='ident'>OptArg</span><span class='op'>></span>,
|
||||
<span class='kw'>pub</span> <span class='ident'>positionals</span>: <span class='ident'>HashMap</span><span class='op'><</span><span class='kw-2'>&</span><span class='lifetime'>'static</span> <span class='ident'>str</span>, <span class='ident'>PosArg</span><span class='op'>></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'>&</span><span class='ident'>App</span>) <span class='op'>-></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>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue