Julio Biason
1 year ago
3 changed files with 150 additions and 0 deletions
@ -0,0 +1,116 @@
|
||||
# This file is automatically @generated by Cargo. |
||||
# It is not intended for manual editing. |
||||
version = 3 |
||||
|
||||
[[package]] |
||||
name = "atty" |
||||
version = "0.2.14" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" |
||||
dependencies = [ |
||||
"hermit-abi", |
||||
"libc", |
||||
"winapi", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "bitflags" |
||||
version = "1.3.2" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" |
||||
|
||||
[[package]] |
||||
name = "clap" |
||||
version = "4.0.26" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" |
||||
dependencies = [ |
||||
"atty", |
||||
"bitflags", |
||||
"clap_lex", |
||||
"strsim", |
||||
"termcolor", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "clap_lex" |
||||
version = "0.3.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" |
||||
dependencies = [ |
||||
"os_str_bytes", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "hermit-abi" |
||||
version = "0.1.19" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" |
||||
dependencies = [ |
||||
"libc", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "libc" |
||||
version = "0.2.137" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" |
||||
|
||||
[[package]] |
||||
name = "os_str_bytes" |
||||
version = "6.4.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" |
||||
|
||||
[[package]] |
||||
name = "strsim" |
||||
version = "0.10.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" |
||||
|
||||
[[package]] |
||||
name = "subcommand" |
||||
version = "0.1.0" |
||||
dependencies = [ |
||||
"clap", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "termcolor" |
||||
version = "1.1.3" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" |
||||
dependencies = [ |
||||
"winapi-util", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "winapi" |
||||
version = "0.3.9" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" |
||||
dependencies = [ |
||||
"winapi-i686-pc-windows-gnu", |
||||
"winapi-x86_64-pc-windows-gnu", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "winapi-i686-pc-windows-gnu" |
||||
version = "0.4.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" |
||||
|
||||
[[package]] |
||||
name = "winapi-util" |
||||
version = "0.1.5" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" |
||||
dependencies = [ |
||||
"winapi", |
||||
] |
||||
|
||||
[[package]] |
||||
name = "winapi-x86_64-pc-windows-gnu" |
||||
version = "0.4.0" |
||||
source = "registry+https://github.com/rust-lang/crates.io-index" |
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" |
@ -0,0 +1,9 @@
|
||||
[package] |
||||
name = "subcommand" |
||||
version = "0.1.0" |
||||
edition = "2021" |
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html |
||||
|
||||
[dependencies] |
||||
clap = "4.0.26" |
@ -0,0 +1,25 @@
|
||||
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...") |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue