clap_derive users can't set both a default help_heading
and an arg-specific help_heading
#2873
Closed
2 tasks done
Milestone
Please complete the following tasks
Rust Version
rustc 1.55.0 (c8dfcfe04 2021-09-06)
Clap Version
v3.0.0-beta.4
Minimal reproducible code
Note: this assumes #2785 is fixed
Steps to reproduce the bug with the above code
Run the test
Actual Behaviour
should_be_in_section_a
is in sectionDEFAULT
Expected Behaviour
should_be_in_section_a
is in sectionHEADING A
Additional Context
PR #1211 originally added
help_heading
with the current priority(
App::help_heading
wins).In #1958, the PR author had proposed to change this
This was reverted on reviewer request because
Re-using args is an important use case but this makes life difficult
for anyone using
help_heading
withclap_derive
because the usercan only call
App::help_heading
once per struct. Derive users can't getper-field granularity with
App::help_heading
like the builder API.As a bonus, I think this will be the least surprising to users. Users
generally expect the more generic specification (App) to be overridden by the
more specific specification (Arg). Honestly, I had thought this Issue's Expected Behavior is
how
help_heading
worked until I dug into the code with #2872.In the argument re-use cases, a workaround is for the reusable arguments
to not set their help_heading and require the caller to set it as
needed
Note: I have a fix ready, just blocked on #2872.
Debug Output
No response
The text was updated successfully, but these errors were encountered: