]> git.proxmox.com Git - rustc.git/blame - vendor/structopt/tests/ui/skip_flatten.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / vendor / structopt / tests / ui / skip_flatten.rs
CommitLineData
f20569fa
XL
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
9use structopt::StructOpt;
10
11#[derive(StructOpt, Debug)]
12#[structopt(name = "make-cookie")]
13struct MakeCookie {
14 #[structopt(short)]
15 s: String,
16
17 #[structopt(skip, flatten)]
18 cmd: Command,
19}
20
21#[derive(StructOpt, Debug)]
22enum Command {
23 #[structopt(name = "pound")]
24 /// Pound acorns into flour for cookie dough.
25 Pound { acorns: u32 },
26
27 Sparkle {
28 #[structopt(short)]
29 color: String,
30 },
31}
32
33impl Default for Command {
34 fn default() -> Self {
35 Command::Pound { acorns: 0 }
36 }
37}
38
39fn main() {
40 let opt = MakeCookie::from_args();
41 println!("{:?}", opt);
42}