2022-02-11 13:07:03 +00:00
|
|
|
// Note: this requires the `derive` feature
|
|
|
|
|
2021-12-15 17:33:10 +00:00
|
|
|
use clap::Parser;
|
|
|
|
|
|
|
|
#[derive(Parser)]
|
|
|
|
#[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-05-21 00:52:04 +00:00
|
|
|
#[clap(long, value_parser)]
|
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);
|
|
|
|
}
|