main()1fn main() { 2 let cmd = clap::Command::new("cargo") 3 .bin_name("cargo") 4 .subcommand_required(true) 5 .subcommand( 6 clap::command!("example").arg( 7 clap::arg!(--"manifest-path" <PATH>) 8 .required(false) 9 .value_parser(clap::value_parser!(std::path::PathBuf)), 10 ), 11 ); 12 let matches = cmd.get_matches(); 13 let matches = match matches.subcommand() { 14 Some(("example", matches)) => matches, 15 _ => unreachable!("clap should ensure we don't get here"), 16 }; 17 let manifest_path = matches.get_one::<std::path::PathBuf>("manifest-path"); 18 println!("{:?}", manifest_path); 19 } 20