mirror of
https://github.com/clap-rs/clap
synced 2024-09-21 14:52:00 +00:00
docs(examples): Don't use is_present with subcommands
Apparently, this isn't supported anymore.
This commit is contained in:
parent
1f0d86a407
commit
4eba65bfaf
3 changed files with 0 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue