Upgrade to clap v3.0.0-beta.2

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-11-09 06:28:40 +05:30
parent b0333f6c94
commit f1ddc97a65
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
3 changed files with 127 additions and 33 deletions

129
Cargo.lock generated
View file

@ -1,14 +1,5 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.33" version = "1.0.33"
@ -55,16 +46,34 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.33.3" version = "3.0.0-beta.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142"
dependencies = [ dependencies = [
"ansi_term",
"atty", "atty",
"bitflags", "bitflags",
"clap_derive",
"indexmap",
"lazy_static",
"os_str_bytes",
"strsim", "strsim",
"termcolor",
"textwrap", "textwrap",
"unicode-width", "unicode-width",
"vec_map",
]
[[package]]
name = "clap_derive"
version = "3.0.0-beta.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
] ]
[[package]] [[package]]
@ -95,6 +104,21 @@ dependencies = [
"walkdir", "walkdir",
] ]
[[package]]
name = "hashbrown"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
[[package]]
name = "heck"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
dependencies = [
"unicode-segmentation",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.17" version = "0.1.17"
@ -115,6 +139,16 @@ dependencies = [
"unicode-normalization", "unicode-normalization",
] ]
[[package]]
name = "indexmap"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]] [[package]]
name = "jobserver" name = "jobserver"
version = "0.1.21" version = "0.1.21"
@ -124,6 +158,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.79" version = "0.2.79"
@ -204,6 +244,12 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "os_str_bytes"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.1.0" version = "2.1.0"
@ -216,6 +262,30 @@ version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.24" version = "1.0.24"
@ -265,9 +335,9 @@ dependencies = [
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.8.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
@ -280,11 +350,20 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "termcolor"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
dependencies = [
"winapi-util",
]
[[package]] [[package]]
name = "textwrap" name = "textwrap"
version = "0.11.0" version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
dependencies = [ dependencies = [
"unicode-width", "unicode-width",
] ]
@ -322,6 +401,12 @@ dependencies = [
"tinyvec", "tinyvec",
] ]
[[package]]
name = "unicode-segmentation"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.8" version = "0.1.8"
@ -351,6 +436,18 @@ version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.3.1" version = "2.3.1"

View file

@ -14,7 +14,7 @@ readme = "README.md"
[dependencies] [dependencies]
anyhow = "1.0.32" anyhow = "1.0.32"
clap = { version = "2.33.3", default-features = false, features = ["suggestions", "color"] } clap = "3.0.0-beta.2"
git2 = "0.13.11" git2 = "0.13.11"
serde = {version = "1.0.116", default-features = false, features = ["derive"] } serde = {version = "1.0.116", default-features = false, features = ["derive"] }
serde_derive = "1.0.116" serde_derive = "1.0.116"

View file

@ -27,8 +27,8 @@ fn main() -> anyhow::Result<()> {
App::new("freeze") App::new("freeze")
.about("Generate a gitice.lock file with all the repositories in the given directory") .about("Generate a gitice.lock file with all the repositories in the given directory")
.setting(AppSettings::ColoredHelp) .setting(AppSettings::ColoredHelp)
.args(&[Arg::with_name("directory") .args(&[Arg::new("directory")
.help("Directory to look for Git repos in") .about("Directory to look for Git repos in")
.required(true) .required(true)
.index(1)]), .index(1)]),
) )
@ -37,13 +37,13 @@ fn main() -> anyhow::Result<()> {
.about("Given a gitice.lock and a directory, clones back all the repositories from the lockfile in the directory") .about("Given a gitice.lock and a directory, clones back all the repositories from the lockfile in the directory")
.setting(AppSettings::ColoredHelp) .setting(AppSettings::ColoredHelp)
.args(&[ .args(&[
Arg::with_name("directory") Arg::new("directory")
.help("Directory to restore repositories in") .about("Directory to restore repositories in")
.required(true) .required(true)
.index(1), .index(1),
Arg::with_name("lockfile") Arg::new("lockfile")
.help("The lockfile to restore repositories from") .about("The lockfile to restore repositories from")
.short("l") .short('l')
.long("lockfile") .long("lockfile")
.required(false) .required(false)
.default_value("gitice.lock") .default_value("gitice.lock")
@ -51,15 +51,12 @@ fn main() -> anyhow::Result<()> {
) )
.get_matches(); .get_matches();
match matches.subcommand() { match matches.subcommand().unwrap() {
("freeze", m) => freeze_repos(m.unwrap().value_of("directory").unwrap())?, ("freeze", m) => freeze_repos(m.value_of("directory").unwrap())?,
("thaw", m) => { ("thaw", m) => thaw_repos(
let m = m.unwrap(); m.value_of("directory").unwrap(),
thaw_repos( m.value_of("lockfile").unwrap(),
m.value_of("directory").unwrap(), )?,
m.value_of("lockfile").unwrap(),
)?
}
(cmd, _) => return Err(anyhow!("unknown subcommand: {}", cmd)), (cmd, _) => return Err(anyhow!("unknown subcommand: {}", cmd)),
} }