2018-02-04 18:05:53 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate clap;
|
|
|
|
|
2018-07-02 18:45:17 +00:00
|
|
|
use clap::Clap;
|
2018-02-04 18:05:53 +00:00
|
|
|
|
|
|
|
arg_enum! {
|
|
|
|
#[derive(Debug)]
|
|
|
|
enum Baz {
|
|
|
|
Foo,
|
|
|
|
Bar,
|
|
|
|
FooBar
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-02 19:06:46 +00:00
|
|
|
#[derive(Clap, Debug)]
|
2018-02-04 18:05:53 +00:00
|
|
|
struct Opt {
|
|
|
|
/// Important argument.
|
2018-07-02 19:06:46 +00:00
|
|
|
#[clap(raw(possible_values = "&Baz::variants()", case_insensitive = "true"))]
|
2018-02-04 18:05:53 +00:00
|
|
|
i: Baz,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2018-07-03 18:55:13 +00:00
|
|
|
let opt = Opt::parse();
|
2018-02-04 18:05:53 +00:00
|
|
|
println!("{:?}", opt);
|
|
|
|
}
|