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