I'm trying to do this, but clap doesn't like the fact that the variants are non-unit:
#[derive(Clone, Debug, ValueEnum)]
enum Descriptor {
Id(u32),
Word(String),
}
#[derive(Debug, Args)]
pub struct MyArgs {
desc: Descriptor,
}
What do I have to do to make this sort of thing work, or am I stuck having to accept a string and parse it myself?
(N.B. I know there is a similar question here, but it's not fully answered and the comments don't make sense to me)
As an alternative you can also use a sub-command:
Which would result in a slightly different but unambiguous CLI interface: