mirror of
https://github.com/clap-rs/clap
synced 2024-12-14 23:02:31 +00:00
b190a6a817
This reduces the need for us to have `clap` as a dependency in `clap_derive`, preparing the way to fix #15.
21 lines
327 B
Rust
21 lines
327 B
Rust
use clap::Parser;
|
|
|
|
#[derive(Parser, Debug)]
|
|
struct Opt {
|
|
#[clap(subcommand)]
|
|
cmd: Command,
|
|
}
|
|
|
|
#[derive(Parser, Debug)]
|
|
enum Command {
|
|
#[clap(external_subcommand)]
|
|
Run(Vec<String>),
|
|
|
|
#[clap(external_subcommand)]
|
|
Other(Vec<String>),
|
|
}
|
|
|
|
fn main() {
|
|
let opt = Opt::parse();
|
|
println!("{:?}", opt);
|
|
}
|