-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
4.0 regression: dashes are not accepted any more #4869
Comments
These are needed as a workaround for clap-rs/clap#4869 . Closes #151
A workaround is to add |
We called this change out in the breaking changes for 4.0 under the "subtle" section, meaning these were the high priority ones to review when upgrading
As for the workaroumd, it is better to use |
Note, that changelog line is very terse and unless you know clap's internals, or you have been pointed towards it, you won't really be able to derive actionable advice from it. Also, even if it is pointed out, maybe it's not the best idea to have that change, given it makes such hybrid uses harder.
Thanks, will do! Question: if #3709 is implemented, will I be able to just specify that? |
The change was made to improve the pure-derive workflow. If you want to declare an arg to conflict with another arg, you now refer to it by the field's name, not what the long name or the value name would be, if it exists. This improves discoverability of the behavior.
We have no plans for controlling naming of |
As per advice in clap-rs/clap#4869
Thanks for informing me, and thanks for the advice. I guess it's a tradeoff decision in the end, although of course I'm not happy that the only way to use arguments both in cargo and cargo-udeps is to either make cargo-udeps not use derives, or to put an explicit |
For my own projects, I recreate the cargo CLI, rather than reuse it (see |
Please complete the following tasks
Rust Version
Clap Version
4.0
Minimal reproducible code
Steps to reproduce the bug with the above code
Do
cargo run -- --foo-bar --someflag
Actual Behaviour
It prints:
Expected Behaviour
It prints:
This is what Clap 3.0 did, you can confirm this by running the example with Clap 3.0, i've written it to compile fine there as well. This, this is a regression of 4.0.0.
Additional Context
This caused est31/cargo-udeps#151 where I list all the
cargo check
flags in a struct that derivesParser
, so that they can be passed on to cargo, but where cargo internally does the equivalent ofarg_matches.try_get_one::<bool>("all-targets")
(it does it via an extension trait on ArgMatches, via afn flag(&self, name: &str) -> bool
function).Debug Output
No response
The text was updated successfully, but these errors were encountered: