Skip to content

Commit

Permalink
fix: Add plural s in suggestions
Browse files Browse the repository at this point in the history
Old: `note: subcommand 'test', 'temp' exist`
New: `note: subcommands 'test', 'temp' exist`
Fixes #4666
  • Loading branch information
corneliusroemer committed Jan 23, 2023
1 parent 90c042e commit 5dcc5c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/error/format.rs
Expand Up @@ -438,6 +438,9 @@ fn did_you_mean(styled: &mut StyledStr, context: &str, valid: &ContextValue) {
styled.none(TAB);
styled.good("note: ");
styled.none(context);
if valid.len() > 1 {
styled.none("s");
}
styled.none(" ");
for (i, valid) in valid.iter().enumerate() {
if i != 0 {
Expand Down
2 changes: 1 addition & 1 deletion tests/builder/subcommands.rs
Expand Up @@ -120,7 +120,7 @@ fn subcmd_did_you_mean_output_ambiguous() {
static DYM_SUBCMD_AMBIGUOUS: &str = "\
error: unrecognized subcommand 'te'
note: subcommand 'test', 'temp' exist
note: subcommands 'test', 'temp' exist
note: to pass 'te' as a value, use 'dym -- te'
Usage: dym [COMMAND]
Expand Down

0 comments on commit 5dcc5c9

Please sign in to comment.