Closed stepancheg closed 1 month ago
When you use a multi-line doc-string, it maps to the long
version of that attribute. So in this case, you are setting about
and long_about
. By specifying a long_about
, you are opting in to -h
being "short help" and --help
being "long help". You just happen to have no other long help and don't want the extra doc string output to be in your help output.
You have to ways to opt-out of long help while still maintaining that doc string.
#[command(long_about = None)]
-h
/ --help
flag and set #[arg(action = ArgAction::HelpShort)]
As this is working as expected, I'm going to close this. If there is a reason we should reconsider that, let us know!
OK, then I think the issue is that long help should not split descriptions into multiple lines when all of them fit on one line.
Anyway, if this is by design, let it be.
Thank you very much for explanations!
Please complete the following tasks
Rust Version
rustc 1.78.0 (9b00956e5 2024-04-29)
Clap Version
4.5.4
Minimal reproducible code
Steps to reproduce the bug with the above code
Actual Behaviour
In the example above, help is printed like this:
Expected Behaviour
Remove the empty line and the last non-empty line from command help, and help looks like this:
Additional Context
Full example: https://github.com/stepancheg/clap-bug-help/blob/master/src/main.rs
Debug Output
Debug output with multiline command help:
Debug output with single-line command help:
Diff between these: