Skip to content

Commit

Permalink
refactor(Arg): removes duplicate and uses Base, Switched, and Valued …
Browse files Browse the repository at this point in the history
…internally now
  • Loading branch information
kbknapp committed Feb 21, 2017
1 parent 65b12f9 commit fb7057c
Show file tree
Hide file tree
Showing 13 changed files with 636 additions and 799 deletions.
5 changes: 2 additions & 3 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use yaml_rust::Yaml;
// Internal
use app::help::Help;
use app::parser::Parser;
use args::{ArgKind, AnyArg, Arg, ArgGroup, ArgMatcher, ArgMatches, ArgSettings};
use args::{AnyArg, Arg, ArgGroup, ArgMatcher, ArgMatches, ArgSettings};
use errors::Error;
use errors::Result as ClapResult;
pub use self::settings::AppSettings;
Expand Down Expand Up @@ -1373,7 +1373,7 @@ impl<'a, 'b> App<'a, 'b> {

if self.p.is_set(AppSettings::PropagateGlobalValuesDown) {
for a in &self.p.global_args {
matcher.propagate(a.name);
matcher.propagate(a.b.name);
}
}

Expand Down Expand Up @@ -1536,7 +1536,6 @@ impl<'n, 'e> AnyArg<'n, 'e> for App<'n, 'e> {
unreachable!("App struct does not support AnyArg::name, this is a bug!")
}
fn id(&self) -> usize { self.p.id }
fn kind(&self) -> ArgKind { ArgKind::Subcmd }
fn overrides(&self) -> Option<&[&'e str]> { None }
fn requires(&self) -> Option<&[(Option<&'e str>, &'n str)]> { None }
fn blacklist(&self) -> Option<&[&'e str]> { None }
Expand Down
145 changes: 83 additions & 62 deletions src/app/parser.rs

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/args/any_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use vec_map::{self, VecMap};

// Internal
use args::settings::ArgSettings;
use args::ArgKind;

#[doc(hidden)]
pub trait AnyArg<'n, 'e>: std_fmt::Display {
Expand Down Expand Up @@ -37,7 +36,6 @@ pub trait AnyArg<'n, 'e>: std_fmt::Display {
fn default_val(&self) -> Option<&'n str>;
fn default_vals_ifs(&self) -> Option<vec_map::Values<(&'n str, Option<&'e str>, &'e str)>>;
fn longest_filter(&self) -> bool;
fn kind(&self) -> ArgKind;
fn val_terminator(&self) -> Option<&'e str>;
}

Expand Down
Loading

0 comments on commit fb7057c

Please sign in to comment.