mirror of
https://github.com/clap-rs/clap
synced 2025-03-04 15:27:16 +00:00
fix(Low Index Multiples): fixes a bug where using low index multiples was propgated to subcommands
Closes #725
This commit is contained in:
parent
00b8d16078
commit
33924e8844
2 changed files with 7 additions and 6 deletions
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue