clap/clap_derive/examples/flatten.rs
2020-01-18 17:40:07 +05:30

29 lines
441 B
Rust

//! How to use flattening.
use clap::Clap;
#[derive(Clap, Debug)]
struct Cmdline {
/// switch verbosity on
#[clap(short)]
verbose: bool,
#[clap(flatten)]
daemon_opts: DaemonOpts,
}
#[derive(Clap, Debug)]
struct DaemonOpts {
/// daemon user
#[clap(short)]
user: String,
/// daemon group
#[clap(short)]
group: String,
}
fn main() {
let opt = Cmdline::parse();
println!("{:?}", opt);
}