mirror of
https://github.com/clap-rs/clap
synced 2024-11-14 00:27:13 +00:00
29 lines
441 B
Rust
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);
|
|
}
|