Perform help formatting/rendering for arg.help(...)
, just like doc comments in clap-derive
#6075
-
Clap derive performs some formatting/rendering of doc comments when displaying them as help text, but this same process does not occur for strings passed to use clap::Parser;
#[derive(Parser)]
struct Cli {
/// Hello
/// world.
foo: Option<String>,
#[arg(help = "Hello\nworld.")]
bar: Option<String>,
}
fn main() {
Cli::parse_from(["foo", "--help"]);
}
Is there any existing option to perform the same formatting with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is derive specific logic for transforming a markdown doc comment to You can manually specify |
Beta Was this translation helpful? Give feedback.
This is derive specific logic for transforming a markdown doc comment to
arg.help
andarg.long_help
. We have issues about how incomplete the markdown support is. I see it unlikely to try to integrate all of that into the builder API though we might offer a parallel API for it. We'll have to see how that logic evolves and is unlikely to be a goal on its own.You can manually specify
#[arg(help)]
and#[arg(long_help)]
though it requires duplicating the first section. On the other hand, it lets you customize things for each specific scenario.