]>
git.proxmox.com Git - rustc.git/blob - vendor/clap/examples/tutorial_builder/03_04_subcommands.rs
1 // Note: this requires the `cargo` feature
3 use clap
::{arg, command, Command}
;
6 let matches
= command
!()
7 .propagate_version(true)
8 .subcommand_required(true)
9 .arg_required_else_help(true)
12 .about("Adds files to myapp")
17 match matches
.subcommand() {
18 Some(("add", sub_matches
)) => println
!(
19 "'myapp add' was used, name is: {:?}",
20 sub_matches
.get_one
::<String
>("NAME")
22 _
=> unreachable
!("Exhausted list of subcommands and subcommand_required prevents `None`"),