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