Skip to content

Commit

Permalink
fix(parser): Further limit num_args to user values
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Aug 3, 2022
1 parent 03f747b commit 1352be3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/parser/parser.rs
Expand Up @@ -1128,8 +1128,11 @@ impl<'help, 'cmd> Parser<'help, 'cmd> {
source
);

// `default_missing_values` does not count (ie to avoid problems with flags)
self.verify_num_args(arg, &raw_vals)?;
// Process before `default_missing_values` to avoid it counting as values from the command
// line
if source == ValueSource::CommandLine {
self.verify_num_args(arg, &raw_vals)?;
}

if raw_vals.is_empty() {
// We assume this case is valid: require equals, but min_vals == 0.
Expand Down

0 comments on commit 1352be3

Please sign in to comment.