• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 clap::Parser;
10 
11 #[derive(Parser, Debug)]
12 struct MakeCookie {
13     #[arg(short)]
14     s: String,
15 
16     #[command(subcommand)]
17     cmd: Option<Vec<Command>>,
18 }
19 
20 #[derive(Parser, Debug)]
21 enum Command {
22     /// Pound acorns into flour for cookie dough.
23     Pound { acorns: u32 },
24 
25     Sparkle {
26         #[arg(short)]
27         color: String,
28     },
29 }
30 
main()31 fn main() {
32     let opt = MakeCookie::parse();
33     println!("{:?}", opt);
34 }
35