mirror of
https://github.com/clap-rs/clap
synced 2024-12-16 15:52:44 +00:00
26 lines
517 B
Rust
26 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);
|
||
|
}
|