• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download

main()1 fn 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                     .value_parser(clap::value_parser!(std::path::PathBuf)),
9             ),
10         );
11     let matches = cmd.get_matches();
12     let matches = match matches.subcommand() {
13         Some(("example", matches)) => matches,
14         _ => unreachable!("clap should ensure we don't get here"),
15     };
16     let manifest_path = matches.get_one::<std::path::PathBuf>("manifest-path");
17     println!("{:?}", manifest_path);
18 }
19