-
-
Notifications
You must be signed in to change notification settings - Fork 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
--help
flag straight up not working even after copy-pasting example
#4398
Comments
*Came to github trying to debug the same issue. I ran into this same problem yesterday as well, and I fixed it by enabling the |
Yes, we broke out help generation into a feature flag. In the migration guide, we have this comment about it
While a main selling point, it isn't the only selling point and people have been wanting flexibility on this for a while. For example, I am considering snapshotting my help in tests and building that in so that I have semi-automated help generation without the costs. What I'm really looking forward to is rust-lang/cargo#3126 which will make it easier to piece meal remove features from clap. As this was most likely a missing |
Ah, thanks for the hindsight. I find it extremely surprising that activating/disabling a feature flag modifies the behavior of the code. For example, if you depend on If I can suggest a way better to do it, the user should explicitly attach the |
I think this comes back to the other comment:
I'm more worried about the out-of-box experience than the |
(sorry if I sound pushy, I'm not actually opinionated about this, happy to end the discussion at any point) Personally I automatically put For this reason, I also don't provide feature flags for my (more recent) crates apart from I really see feature flags as one of the greatest mistakes of the Rust language in general.
I have the feeling that this is probably a decade away, if ever. |
I wonder how much of this is features themselves vs the UX not being fully developed. For example, I've found For a lot of feature uses, I do hope rust-lang/rfcs#3243 goes through as an alternative.
Maybe I'm being optimistic but I'm hoping for next edition. The cargo team is interested in solving the "adding new default features without breaking" problem and several of us on the cargo team are particularly hopeful for this solution. I don't know about others but I've just not moved down my priority list enough to get to writing an RFC for it. |
Please complete the following tasks
Rust Version
v1.64.0
Clap Version
v4.0.15
Minimal reproducible code
I copy-pasted the first example of this page, however all examples from that page that I've tried exhibit the same problem. I didn't manage to write a code where the
--help
flag worked.Steps to reproduce the bug with the above code
cargo run -- --help
Or
cargo build
followed with./target/debug/foo --help
Actual Behaviour
Expected Behaviour
It should print some help, like explained in the page:
Additional Context
I realize that this issue is similar to #4392, but in this case, I don't know, it just never works. I also very confused, because the
--help
is the 101 of what this library does, I wouldn't expect it to straight up not work in all scenarios.Interestingly, however, the
--version
flag works.Debug Output
The text was updated successfully, but these errors were encountered: