2021-12-15 11:33:10 -06:00
|
|
|
use clap::Parser;
|
|
|
|
|
2022-07-19 13:29:31 -05:00
|
|
|
#[derive(Parser)] // requires `derive` feature
|
2021-12-15 11:33:10 -06:00
|
|
|
#[clap(name = "cargo")]
|
|
|
|
#[clap(bin_name = "cargo")]
|
|
|
|
enum Cargo {
|
|
|
|
ExampleDerive(ExampleDerive),
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(clap::Args)]
|
2022-01-10 18:47:20 -06:00
|
|
|
#[clap(author, version, about, long_about = None)]
|
2021-12-15 11:33:10 -06:00
|
|
|
struct ExampleDerive {
|
2022-07-22 19:36:26 -05:00
|
|
|
#[clap(long)]
|
2021-12-15 11:33:10 -06:00
|
|
|
manifest_path: Option<std::path::PathBuf>,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let Cargo::ExampleDerive(args) = Cargo::parse();
|
|
|
|
println!("{:?}", args.manifest_path);
|
|
|
|
}
|