use gumdrop::Options;
#[derive(Debug, Options)]
struct MyOptions {
#[options(help = "print help message")]
help: bool,
#[options(help = "be verbose")]
verbose: bool,
#[options(command)]
command: Option<Command>,
}
#[derive(Debug, Options)]
enum Command {
#[options(help = "make stuff")]
Make(MakeOpts),
#[options(help = "install stuff")]
Install(InstallOpts),
}
#[derive(Debug, Options)]
struct MakeOpts {
#[options(help = "print help message")]
help: bool,
#[options(free)]
free: Vec<String>,
#[options(help = "number of jobs", meta = "N")]
jobs: Option<u32>,
}
#[derive(Debug, Options)]
struct InstallOpts {
#[options(help = "print help message")]
help: bool,
#[options(help = "target directory")]
dir: Option<String>,
}
fn main() {
let opts = MyOptions::parse_args_default_or_exit();
println!("{:#?}", opts);
}