clap/examples/flatten.rs
2018-04-12 11:27:57 +02:00

25 lines
517 B
Rust

#[macro_use]
extern crate structopt;
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
struct Cmdline {
#[structopt(short = "v", help = "switch on verbosity")]
verbose: bool,
#[structopt(flatten)]
daemon_opts: DaemonOpts,
}
#[derive(StructOpt, Debug)]
struct DaemonOpts {
#[structopt(short = "u", help = "daemon user")]
user: String,
#[structopt(short = "g", help = "daemon group")]
group: String,
}
fn main() {
let opt = Cmdline::from_args();
println!("{:?}", opt);
}