Skip to content

Commit

Permalink
fix(parser): Report correct num_args on too-few
Browse files Browse the repository at this point in the history
Fixes #5526
  • Loading branch information
epage committed Jun 10, 2024
1 parent e0c9619 commit cf5c958
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clap_builder/src/error/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ fn write_dynamic_context(
let were_provided = singular_or_plural(*actual_num_values as usize);
let _ = write!(
styled,
"{}{min_values}{} more values required by '{}{invalid_arg}{}'; only {}{actual_num_values}{}{were_provided}",
"{}{min_values}{} values required by '{}{invalid_arg}{}'; only {}{actual_num_values}{}{were_provided}",
valid.render(),
valid.render_reset(),
literal.render(),
Expand Down
4 changes: 2 additions & 2 deletions tests/builder/multiple_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ fn option_min_less() {
assert_eq!(err.kind(), ErrorKind::TooFewValues);
#[cfg(feature = "error-context")]
assert_data_eq!(err.to_string(), str![[r#"
error: 3 more values required by '-o <option> <option> <option>...'; only 2 were provided
error: 3 values required by '-o <option> <option> <option>...'; only 2 were provided
Usage: multiple_values [OPTIONS]
Expand Down Expand Up @@ -603,7 +603,7 @@ fn positional_min_less() {
assert_eq!(err.kind(), ErrorKind::TooFewValues);
#[cfg(feature = "error-context")]
assert_data_eq!(err.to_string(), str![[r#"
error: 3 more values required by '[pos] [pos] [pos]...'; only 2 were provided
error: 3 values required by '[pos] [pos] [pos]...'; only 2 were provided
Usage: myprog [pos] [pos] [pos]...
Expand Down

0 comments on commit cf5c958

Please sign in to comment.