-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
A-helpArea: documentation, including docs.rs, readme, examples, etc...Area: documentation, including docs.rs, readme, examples, etc...C-bugCategory: bugCategory: bugE-easyCall for participation: Experience needed to fix: Easy / not muchCall for participation: Experience needed to fix: Easy / not muchM-breaking-changeMeta: Implementing or merging this will introduce a breaking change.Meta: Implementing or merging this will introduce a breaking change.
Milestone
Description
Discussed in #6070
Originally posted by timmc July 13, 2025
I have a ValueEnum with variants that have detailed help (that is, more than one paragraph of doc comments). How can I get clap to show this when --help
is invoked?
Example using clap 4.5.1:
use clap::{Parser, ValueEnum};
#[derive(Clone, Debug, ValueEnum)]
enum Multi {
/// Foo short help.
///
/// Foo detailed help. This should be exposed in --help.
Foo,
/// Bar short help.
///
/// Bar detailed help. This should be exposed in --help.
Bar,
}
#[derive(Clone, Debug, Parser)]
struct Cli {
myopt: Multi,
}
pub fn main() {
Cli::parse();
}
Output from --help
:
Usage: clap_demo <MYOPT>
Arguments:
<MYOPT>
Possible values:
- foo: Foo short help
- bar: Bar short help
Options:
-h, --help
Print help (see a summary with '-h')
I'd like some way of exposing the full docstring of Foo
and Bar
in the myopt
help string.
Metadata
Metadata
Assignees
Labels
A-helpArea: documentation, including docs.rs, readme, examples, etc...Area: documentation, including docs.rs, readme, examples, etc...C-bugCategory: bugCategory: bugE-easyCall for participation: Experience needed to fix: Easy / not muchCall for participation: Experience needed to fix: Easy / not muchM-breaking-changeMeta: Implementing or merging this will introduce a breaking change.Meta: Implementing or merging this will introduce a breaking change.