1 // Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu> 2 // 3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or 4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your 6 // option. This file may not be copied, modified, or distributed 7 // except according to those terms. 8 9 use structopt::StructOpt; 10 11 #[derive(StructOpt, Debug)] 12 #[structopt(name = "basic")] 13 struct Opt { 14 #[structopt(short, default_value = 1)] 15 n: Option<u32>, 16 } 17 main()18fn main() { 19 let opt = Opt::from_args(); 20 println!("{:?}", opt); 21 } 22