mirror of
https://github.com/clap-rs/clap
synced 2025-01-22 01:14:59 +00:00
5430df7a0f
This adds the ability derive additional options for the group creation. Fixes #4574
23 lines
360 B
Rust
23 lines
360 B
Rust
use clap::Parser;
|
|
|
|
#[derive(Parser, Debug)]
|
|
#[command(name = "basic")]
|
|
struct Opt {
|
|
#[command(flatten)]
|
|
source: Source,
|
|
}
|
|
|
|
#[derive(clap::Args, Debug)]
|
|
#[group(required = true, name = "src")]
|
|
struct Source {
|
|
#[arg(short)]
|
|
git: String,
|
|
|
|
#[arg(short)]
|
|
path: String,
|
|
}
|
|
|
|
fn main() {
|
|
let opt = Opt::parse();
|
|
println!("{:?}", opt);
|
|
}
|