structopt 0.3.1

Parse command line argument by defining a struct.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use structopt::StructOpt;

#[derive(StructOpt, Debug)]
#[structopt(name = "test")]
pub struct Opt {
    #[structopt(long)]
    a: u32,
    #[structopt(skip, long)]
    b: u32,
}

fn main() {
    let opt = Opt::from_args();
    println!("{:?}", opt);
}