Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(error): Include -- in more cases #5356

Merged
merged 2 commits into from
Feb 16, 2024
Merged

fix(error): Include -- in more cases #5356

merged 2 commits into from
Feb 16, 2024

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
22 checks passed
@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.

None yet

1 participant