• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //! How to use flattening.
2 
3 use structopt::StructOpt;
4 
5 #[derive(StructOpt, Debug)]
6 struct Cmdline {
7     /// switch verbosity on
8     #[structopt(short)]
9     verbose: bool,
10 
11     #[structopt(flatten)]
12     daemon_opts: DaemonOpts,
13 }
14 
15 #[derive(StructOpt, Debug)]
16 struct DaemonOpts {
17     /// daemon user
18     #[structopt(short)]
19     user: String,
20 
21     /// daemon group
22     #[structopt(short)]
23     group: String,
24 }
25 
main()26 fn main() {
27     let opt = Cmdline::from_args();
28     println!("{:?}", opt);
29 }
30