2022-02-11 07:07:03 -06:00
|
|
|
// Note: this requires the `derive` feature
|
|
|
|
|
2021-12-15 11:33:10 -06:00
|
|
|
use clap::Parser;
|
|
|
|
|
|
|
|
#[derive(Parser)]
|
|
|
|
#[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 {
|
|
|
|
#[clap(long, parse(from_os_str))]
|
|
|
|
manifest_path: Option<std::path::PathBuf>,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let Cargo::ExampleDerive(args) = Cargo::parse();
|
|
|
|
println!("{:?}", args.manifest_path);
|
|
|
|
}
|