Skip to content

Commit

Permalink
fix(Low Index Multiples): fixes a bug where using low index multiples…
Browse files Browse the repository at this point in the history
… was propgated to subcommands

Closes #725
  • Loading branch information
kbknapp committed Nov 2, 2016
1 parent 00b8d16 commit 33924e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,8 +1322,6 @@ impl<'a, 'b> App<'a, 'b> {
where I: IntoIterator<Item = T>,
T: Into<OsString> + Clone
{
// Verify all positional assertions pass
self.p.verify_positionals();
// If there are global arguments, or settings we need to propgate them down to subcommands
// before parsing incase we run into a subcommand
self.p.propogate_globals();
Expand Down
11 changes: 7 additions & 4 deletions src/app/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ impl<'a, 'b> Parser<'a, 'b>
"When using a positional argument with .multiple(true) that is *not the last* \
positional argument, the last positional argument (i.e the one with the highest \
index) *must* have .required(true) set.");

debug_assert!({
let num = self.positionals.len() - 1;
self.positionals.get(num).unwrap().is_set(ArgSettings::Multiple)
Expand Down Expand Up @@ -704,10 +704,13 @@ impl<'a, 'b> Parser<'a, 'b>
it: &mut Peekable<I>)
-> ClapResult<()>
where I: Iterator<Item = T>,
T: Into<OsString> + Clone
T: Into<OsString> + Clone
{
debugln!("fn=get_matches_with;");
// First we create the `--help` and `--version` arguments and add them if
// Verify all positional assertions pass
self.verify_positionals();

// Next we create the `--help` and `--version` arguments and add them if
// necessary
self.create_help_and_version();

Expand All @@ -719,7 +722,7 @@ impl<'a, 'b> Parser<'a, 'b>
debugln!("Begin parsing '{:?}' ({:?})", arg_os, &*arg_os.as_bytes());

// Is this a new argument, or values from a previous option?
let starts_new_arg = is_new_arg(&arg_os);
let starts_new_arg = is_new_arg(&arg_os);

// Has the user already passed '--'? Meaning only positional args follow
if !self.trailing_vals {
Expand Down

0 comments on commit 33924e8

Please sign in to comment.