Detailed help for ValueEnum variants
Author: epageCreated Aug 8, 2025Updated Sep 26, 2026
LabelsC-bugM-breaking-changeA-helpE-easy
Discussed in https://github.com/clap-rs/clap/discussions/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.
Source: clap-rs/clap