clap-rs / clap

A full featured, fast Command Line Argument Parser for Rust
docs.rs/clap
Apache License 2.0
13.65k stars 1.02k forks source link

feat(help): Allow styling for inline context #5482

Open GilShoshan94 opened 2 months ago

GilShoshan94 commented 2 months ago

Allow customizing styling for inline context [default], [possible values], [env], [aliases] and [short aliases]

fix #5093

Hi @epage,

Added the fields inline_context and inline_context_value to Styled.

inline_context_value is an Option<anstyle::Style>, and if not explicitly set, will fallback to inline_context. The default is simple unstyled as you requested.

I just have one problem with the styling of "Possible Values:" (for enumerated values / multiple choices): For regular help (-h): It's ok, I styled like the others inline contexts case. But for the long_help (--help), currently the enumerated values are already styled with the literal style (see here in code)

For now I left it as it is probabling at least a minor release. It feels a bit incosistent now, and I think I should change the style to inline_context_value.

Let me know if I can add this extra modification.