[docs] No mention how to skip enum variants on the ValueEnum
derive macro
#4327
Labels
C-enhancement
Category: Raise on the bar on expectations
ValueEnum
derive macro
#4327
Please complete the following tasks
Clap Version
4.0.7
Describe your use case
I was looking for a way to skip a variant from an enum, when using the
ValueEnum
derive macro. Turns out there actually IS a way, but it's not mentioned anywhere in the reference in a direct way.Simple example:
The
hide
attribute is mentioned (somewhat), as one can check the available functions on thePossibleValue
struct, but it's not the same as it only hides it in the docs. Only with#[value(skip)]
it's fully omitted and becomes an impossible value to create through the CLI.The
skip
attribute is only mentioned in a few places in the derive reference:Subcommand
specific attributes: https://docs.rs/clap/4.0.7/clap/_derive/index.html#command-attributesDefault::default()
or the given expression, so it doesn't look applicable for enums: https://docs.rs/clap/4.0.7/clap/_derive/index.html#arggroup-attributesDescribe the solution you'd like
There is already a
ValueEnum
section for attributes in the docs: https://docs.rs/clap/4.0.7/clap/_derive/index.html#valueenum-attributesThis one only needs an additional entry for the
skip
attribute, describing that it can be used to omit variants from the generated implementation.Alternatives, if applicable
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: