aboutsummaryrefslogtreecommitdiff
path: root/structopt/examples/flatten.rs
blob: d51647f99b37b14a65b24b0dc9fef21c8cc757b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! How to use flattening.

use structopt::StructOpt;

#[derive(StructOpt, Debug)]
struct Cmdline {
    /// switch verbosity on
    #[structopt(short)]
    verbose: bool,

    #[structopt(flatten)]
    daemon_opts: DaemonOpts,
}

#[derive(StructOpt, Debug)]
struct DaemonOpts {
    /// daemon user
    #[structopt(short)]
    user: String,

    /// daemon group
    #[structopt(short)]
    group: String,
}

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