mirror of
https://github.com/clap-rs/clap
synced 2024-12-15 15:22:30 +00:00
25 lines
468 B
Rust
25 lines
468 B
Rust
#[macro_use]
|
|
extern crate clap;
|
|
|
|
use clap::Clap;
|
|
|
|
#[derive(Clap, Debug)]
|
|
struct Cmdline {
|
|
#[clap(short = "v", help = "switch on verbosity")]
|
|
verbose: bool,
|
|
#[clap(flatten)]
|
|
daemon_opts: DaemonOpts,
|
|
}
|
|
|
|
#[derive(Clap, Debug)]
|
|
struct DaemonOpts {
|
|
#[clap(short = "u", help = "daemon user")]
|
|
user: String,
|
|
#[clap(short = "g", help = "daemon group")]
|
|
group: String,
|
|
}
|
|
|
|
fn main() {
|
|
let opt = Cmdline::parse();
|
|
println!("{:?}", opt);
|
|
}
|