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
default_value_if depends on order in struct #4713
Comments
For reference, in [dependencies]
clap = { version = "4.1.6", features = ["debug", "derive"] } |
Using
I am not sure what is happening here with |
Thanks for the explanation; your suggestion works perfectly. |
@mattmadeofpasta thanks for providing that answer! I'm going to re-open though as generally the |
I went ahead and marked this as a breaking change and scheduled it for 5.0. This is one of those cases where the line between bug fix and breaking change is unclear, so I marked it as the more extreme case until a more thorough determination can be made. |
Past changes like this were treated as non-breaking |
As shown in <clap-rs/clap#4713>, instead of `ArgPredicate::IsPresent` to detect `--basis-current`, it should be `ArgPredicate::Equals("true".into())`. This allows arbitrary ordering of clap arguments so that help text can be ordered as desired.
Please complete the following tasks
Rust Version
rustc 1.65.0 (897e37553 2022-11-02)
Clap Version
4.1.6
Minimal reproducible code
Steps to reproduce the bug with the above code
Actual Behaviour
This output is generated when no options are given:
Note that
flag2
is true.Expected Behaviour
I expected that
flag1
,flag2
, andimply_both
would all befalse
.Note that when I move the
imply_both
argument to the end of theCli
struct, it works as I expect:But with this ordering, the automatically generated help is not in my preferred order.
Additional Context
No response
Debug Output
The text was updated successfully, but these errors were encountered: