-
I'm trying to specify the default value for an enum using #[derive(clap::Parser)]
struct Opts {
#[clap(default_value_t = AorB::A)]
aorb: AorB,
}
#[derive(Clone, clap::ValueEnum)]
enum AorB {
A,
B,
} I can work around the issue by using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The core error message is
This is needed to render the default value in the help. You can use the |
Beta Was this translation helpful? Give feedback.
The core error message is
This is needed to render the default value in the help. You can use the
ValueEnum
trait to implement this: https://github.com/clap-rs/clap/blob/master/clap_builder/src/util/color.rs#L82