clap/clap_derive/examples/arg_enum.rs

20 lines
260 B
Rust
Raw Normal View History

2020-04-22 07:25:41 +00:00
use clap::Clap;
#[derive(Clap, Debug, PartialEq)]
enum ArgChoice {
Foo,
Bar,
Baz,
}
#[derive(Clap, PartialEq, Debug)]
struct Opt {
#[clap(arg_enum)]
arg: ArgChoice,
}
fn main() {
let opt = Opt::parse();
println!("{:#?}", opt);
}