Skip to content

Conversation

@epage
Copy link
Member

@epage epage commented Feb 16, 2024

Inspired by rust-lang/cargo#12494.
Part of this is that our "did you mean" does prefix checks so it can be
overly aggressive in providing suggestions.
To avoid providing needless suggestions I limited this change to last
/ trailing_var_arg as those convey that -- is more likely a valid
suggestion.

Inspired by rust-lang/cargo#12494.
Part of this is that our "did you mean" does prefix checks so it can be
overly aggressive in providing suggestions.
To avoid providing needless suggestions I limited this change to `last`
/ `trailing_var_arg` as those convey that `--` is more likely a valid
suggestion.
@epage epage merged commit 7b624ca into clap-rs:master Feb 16, 2024
@epage epage deleted the escape branch February 16, 2024 13:07
bors added a commit to rust-lang/cargo that referenced this pull request Feb 16, 2024
fix(test): Suggest `--` for libtest arguments

We already do this so long as the argument doesn't look like a `cargo test` argument (e.g. `--show-output`)
but `--ignored` looks like `--ignore-rust-version` do the the suggestion algorithms prefix checks.

Before
```
error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.
```
After
```
error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'
  tip: to pass '--ignored' as a value, use '-- --ignored'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.
```

This was fixed in clap-rs/clap#5356 and we just need to update to take advantage of it.

Fixes #12494
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant