1 use clap::Parser;
2 
3 #[derive(Parser)] // requires `derive` feature
4 #[clap(name = "cargo")]
5 #[clap(bin_name = "cargo")]
6 enum Cargo {
7     ExampleDerive(ExampleDerive),
8 }
9 
10 #[derive(clap::Args)]
11 #[clap(author, version, about, long_about = None)]
12 struct ExampleDerive {
13     #[clap(long, value_parser)]
14     manifest_path: Option<std::path::PathBuf>,
15 }
16 
main()17 fn main() {
18     let Cargo::ExampleDerive(args) = Cargo::parse();
19     println!("{:?}", args.manifest_path);
20 }
21