docs(examples): Don't use is_present with subcommands

Apparently, this isn't supported anymore.
This commit is contained in:
Ed Page 2021-11-11 19:17:36 -06:00
parent 1f0d86a407
commit 4eba65bfaf
3 changed files with 0 additions and 15 deletions

View file

@ -35,11 +35,6 @@ fn main() {
)
.get_matches();
// You can check if a subcommand was used like normal
if matches.is_present("add") {
println!("'myapp add' was run.");
}
// You can get the independent subcommand matches (which function exactly like App matches)
if let Some(matches) = matches.subcommand_matches("add") {
// Safe to use unwrap() because of the required() option

View file

@ -85,11 +85,6 @@ fn main() {
// At this point, the matches we have point to git. Keep this in mind...
// You can check if one of git's subcommands was used
if matches.is_present("clone") {
println!("'git clone' was run.");
}
// You can see which subcommand was used
if let Some(subcommand) = matches.subcommand_name() {
println!("'git {}' was used", subcommand);

View file

@ -17,11 +17,6 @@ fn main() {
)
.get_matches();
// You can check if a subcommand was used like normal
if matches.is_present("ls") {
println!("'myapp add' was run.");
}
// You can get the independent subcommand matches (which function exactly like App matches)
if let Some(matches) = matches.subcommand_matches("ls") {
// Safe to use unwrap() because of the required() option