]> git.proxmox.com Git - rustc.git/blob - vendor/clap/examples/cargo-example.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / vendor / clap / examples / cargo-example.rs
1 // Note: this requires the `cargo` feature
2
3 fn main() {
4 let cmd = clap::Command::new("cargo")
5 .bin_name("cargo")
6 .subcommand_required(true)
7 .subcommand(
8 clap::command!("example").arg(
9 clap::arg!(--"manifest-path" <PATH>)
10 .required(false)
11 .allow_invalid_utf8(true),
12 ),
13 );
14 let matches = cmd.get_matches();
15 let matches = match matches.subcommand() {
16 Some(("example", matches)) => matches,
17 _ => unreachable!("clap should ensure we don't get here"),
18 };
19 let manifest_path = matches
20 .value_of_os("manifest-path")
21 .map(std::path::PathBuf::from);
22 println!("{:?}", manifest_path);
23 }