You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
603 B
26 lines
603 B
2 years ago
|
use clap::Arg;
|
||
|
use clap::Command;
|
||
|
|
||
|
fn main() {
|
||
|
let command = Command::new("example")
|
||
|
.arg(
|
||
|
Arg::new("working_directory")
|
||
|
.short('w')
|
||
|
.long("working-directory"),
|
||
|
)
|
||
|
.subcommand(
|
||
|
Command::new("run")
|
||
|
.about("Run tasks")
|
||
|
.arg(Arg::new("cases")),
|
||
|
);
|
||
|
|
||
|
let matches = command.get_matches();
|
||
|
|
||
|
match matches.subcommand() {
|
||
|
Some(("run", _sub_matches)) => println!("It's run"),
|
||
|
_ => {
|
||
|
println!("Finding out if it an external command...")
|
||
|
}
|
||
|
}
|
||
|
}
|