fix(error): suggest removing -- when a known flag follows it#6370
Open
kimjune01 wants to merge 2 commits into
Open
fix(error): suggest removing -- when a known flag follows it#6370kimjune01 wants to merge 2 commits into
kimjune01 wants to merge 2 commits into
Conversation
Member
|
I would recommend against AI PR descriptions as they focus on the wrong details. Our contrib guide recommends a particular commit structure. You can read more about it at https://epage.github.io/dev/pr-style/#c-test |
When the parser hits a flag-like arg after `--`, check if it matches a known long or short flag. If so, emit a contextual error suggesting the user remove the separator. Fixes clap-rs#3604
Author
|
Fair point — I've restructured the PR per your commit guidelines: test commit first (C-TEST), then the fix. Also rewrote the description. Let me know if this is closer to what you'd like. |
1f55860 to
e8ea665
Compare
epage
reviewed
May 11, 2026
|
|
||
| #[test] | ||
| #[cfg(feature = "error-context")] | ||
| fn flag_used_after_double_dash() { |
Member
There was a problem hiding this comment.
C-TEST says that this should be reproducing the undesired behavior and then the follow up commit should update the test for the new behavior.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a user writes
app -- --devand--devis a known flag, the error now suggests removing the--separator instead of showing a generic unknown argument error.Split per C-TEST: first commit reproduces the problem, second commit adds the fix.
Fixes #3604