diff --git a/.gitignore b/.gitignore index ea8c4bf..85842c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +./PATH diff --git a/Cargo.lock b/Cargo.lock index ae1f614..c493c56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,7 +16,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -49,12 +49,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" - [[package]] name = "bytes" version = "1.1.0" @@ -88,12 +82,6 @@ version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -142,7 +130,7 @@ dependencies = [ "regex", "terminal_size", "unicode-width", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -167,7 +155,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -177,14 +165,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] -name = "download_rs" -version = "0.2.0" +name = "download_rs_reborned" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47d9680cf49ce700aba2ea4991f745fbe06b54b2262ea6bf8e1798f436b2bad" +checksum = "fa23e9049cd76fb013d0b06a8e2614e5d3e0b01e0588f1497967051a7f5ad03f" dependencies = [ "indicatif", - "reqwest 0.10.10", - "tokio 0.2.25", + "reqwest", + "tokio", ] [[package]] @@ -199,7 +187,7 @@ version = "0.8.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dc8abb250ffdda33912550faa54c88ec8b998dec0b2c55ab224921ce11df" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -217,7 +205,7 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crc32fast", "libc", "miniz_oxide", @@ -254,22 +242,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures-channel" version = "0.3.19" @@ -313,38 +285,18 @@ dependencies = [ "futures-io", "futures-task", "memchr", - "pin-project-lite 0.2.8", + "pin-project-lite", "pin-utils", "slab", ] -[[package]] -name = "h2" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535" -dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio 0.2.25", - "tokio-util 0.3.1", - "tracing", - "tracing-futures", -] - [[package]] name = "h2" version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9f1f717ddc7b2ba36df7e871fd88db79326551d3d6f1fc406fbfd28b582ff8e" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", "futures-core", "futures-sink", @@ -352,8 +304,8 @@ dependencies = [ "http", "indexmap", "slab", - "tokio 1.16.1", - "tokio-util 0.6.9", + "tokio", + "tokio-util", "tracing", ] @@ -384,30 +336,20 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" dependencies = [ - "bytes 1.1.0", + "bytes", "fnv", "itoa 1.0.1", ] -[[package]] -name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" -dependencies = [ - "bytes 0.5.6", - "http", -] - [[package]] name = "http-body" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ - "bytes 1.1.0", + "bytes", "http", - "pin-project-lite 0.2.8", + "pin-project-lite", ] [[package]] @@ -416,89 +358,46 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" -[[package]] -name = "httpdate" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" - [[package]] name = "httpdate" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" -[[package]] -name = "hyper" -version = "0.13.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" -dependencies = [ - "bytes 0.5.6", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.2.7", - "http", - "http-body 0.3.1", - "httparse", - "httpdate 0.3.2", - "itoa 0.4.8", - "pin-project", - "socket2 0.3.19", - "tokio 0.2.25", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "0.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-channel", "futures-core", "futures-util", - "h2 0.3.11", + "h2", "http", - "http-body 0.4.4", + "http-body", "httparse", - "httpdate 1.0.2", + "httpdate", "itoa 0.4.8", - "pin-project-lite 0.2.8", - "socket2 0.4.2", - "tokio 1.16.1", + "pin-project-lite", + "socket2", + "tokio", "tower-service", "tracing", "want", ] -[[package]] -name = "hyper-tls" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" -dependencies = [ - "bytes 0.5.6", - "hyper 0.13.10", - "native-tls", - "tokio 0.2.25", - "tokio-tls", -] - [[package]] name = "hyper-tls" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.1.0", - "hyper 0.14.16", + "bytes", + "hyper", "native-tls", - "tokio 1.16.1", + "tokio", "tokio-native-tls", ] @@ -525,9 +424,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.13.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8572bccfb0665e70b7faf44ee28841b8e0823450cd4ad562a76b5a3c4bf48487" +checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" dependencies = [ "console", "lazy_static", @@ -541,16 +440,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", + "cfg-if", ] [[package]] @@ -588,30 +478,22 @@ checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" [[package]] name = "jvman" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", + "console", "dotenv", - "download_rs", + "download_rs_reborned", "http", + "indicatif", "json", - "reqwest 0.11.9", + "reqwest", "serde", - "tokio 1.16.1", + "tokio", "toml", "zip", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -639,7 +521,7 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -660,16 +542,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "mime_guess" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "miniz_oxide" version = "0.4.4" @@ -680,25 +552,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow 0.2.2", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "0.7.14" @@ -707,44 +560,9 @@ checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" dependencies = [ "libc", "log", - "miow 0.3.7", + "miow", "ntapi", - "winapi 0.3.9", -] - -[[package]] -name = "mio-named-pipes" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" -dependencies = [ - "log", - "mio 0.6.23", - "miow 0.3.7", - "winapi 0.3.9", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio 0.6.23", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "winapi", ] [[package]] @@ -753,7 +571,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -774,24 +592,13 @@ dependencies = [ "tempfile", ] -[[package]] -name = "net2" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "ntapi" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -806,9 +613,9 @@ dependencies = [ [[package]] name = "number_prefix" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "once_cell" @@ -823,7 +630,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -875,12 +682,12 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -889,32 +696,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pin-project" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - [[package]] name = "pin-project-lite" version = "0.2.8" @@ -1005,42 +786,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "reqwest" -version = "0.10.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" -dependencies = [ - "base64", - "bytes 0.5.6", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "http-body 0.3.1", - "hyper 0.13.10", - "hyper-tls 0.4.3", - "ipnet", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "native-tls", - "percent-encoding", - "pin-project-lite 0.2.8", - "serde", - "serde_urlencoded", - "tokio 0.2.25", - "tokio-tls", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", + "winapi", ] [[package]] @@ -1050,15 +796,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f242f1488a539a79bac6dbe7c8609ae43b7914b7736210f239a37cccb32525" dependencies = [ "base64", - "bytes 1.1.0", + "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.11", + "h2", "http", - "http-body 0.4.4", - "hyper 0.14.16", - "hyper-tls 0.5.0", + "http-body", + "hyper", + "hyper-tls", "ipnet", "js-sys", "lazy_static", @@ -1066,11 +812,11 @@ dependencies = [ "mime", "native-tls", "percent-encoding", - "pin-project-lite 0.2.8", + "pin-project-lite", "serde", "serde_json", "serde_urlencoded", - "tokio 1.16.1", + "tokio", "tokio-native-tls", "url", "wasm-bindgen", @@ -1092,7 +838,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ "lazy_static", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1188,17 +934,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" -[[package]] -name = "socket2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "winapi 0.3.9", -] - [[package]] name = "socket2" version = "0.4.2" @@ -1206,7 +941,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1232,12 +967,12 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "libc", "redox_syscall", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1256,7 +991,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1293,7 +1028,7 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1311,58 +1046,23 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" -[[package]] -name = "tokio" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" -dependencies = [ - "bytes 0.5.6", - "fnv", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio 0.6.23", - "mio-named-pipes", - "mio-uds", - "num_cpus", - "pin-project-lite 0.1.12", - "signal-hook-registry", - "slab", - "tokio-macros 0.2.6", - "winapi 0.3.9", -] - [[package]] name = "tokio" version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c27a64b625de6d309e8c57716ba93021dccf1b3b5c97edd6d3dd2d2135afc0a" dependencies = [ - "bytes 1.1.0", + "bytes", "libc", "memchr", - "mio 0.7.14", + "mio", "num_cpus", "once_cell", "parking_lot", - "pin-project-lite 0.2.8", + "pin-project-lite", "signal-hook-registry", - "tokio-macros 1.7.0", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "tokio-macros", + "winapi", ] [[package]] @@ -1383,31 +1083,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ "native-tls", - "tokio 1.16.1", -] - -[[package]] -name = "tokio-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" -dependencies = [ - "native-tls", - "tokio 0.2.25", -] - -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes 0.5.6", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.1.12", - "tokio 0.2.25", + "tokio", ] [[package]] @@ -1416,12 +1092,12 @@ version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-core", "futures-sink", "log", - "pin-project-lite 0.2.8", - "tokio 1.16.1", + "pin-project-lite", + "tokio", ] [[package]] @@ -1445,9 +1121,8 @@ version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" dependencies = [ - "cfg-if 1.0.0", - "log", - "pin-project-lite 0.2.8", + "cfg-if", + "pin-project-lite", "tracing-core", ] @@ -1460,31 +1135,12 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "try-lock" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.7" @@ -1558,9 +1214,7 @@ version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" dependencies = [ - "cfg-if 1.0.0", - "serde", - "serde_json", + "cfg-if", "wasm-bindgen-macro", ] @@ -1585,7 +1239,7 @@ version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -1630,12 +1284,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -1646,12 +1294,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1664,7 +1306,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1679,17 +1321,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d3d6cc1..f7459a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] edition = "2021" name = "jvman" -version = "0.1.0" +version = "0.1.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] clap = {version = "3.0.10", features = ["derive"]} -download_rs = {version = "0.2.0", features = ["sync_download"]} +download_rs_reborned = {version = "0.2.0", features = ["sync_download"]} http = "0.2.6" json = "0.12.4" reqwest = {version = "0.11", features = ["json"]} @@ -16,4 +16,6 @@ tokio = {version = "1", features = ["full"]} toml = "0.5" zip = "0.5.13" dotenv = "0.15.0" +console = "0.15.0" +indicatif = "0.16.2" # windows-sys = {version = "0.32.0", features = ["Win32_Foundation","Win32_Security", "Win32_System_Threading", "Win32_System_SystemServices"]} diff --git a/PATH b/PATH new file mode 100644 index 0000000..835dbac --- /dev/null +++ b/PATH @@ -0,0 +1 @@ +E:\JavaVersionManager\OpenJDK\bin;C:\Program Files\Eclipse Foundation\jdk-16.0.2.7-hotspot\bin;C:\Program Files\Eclipse Adoptium\jdk-11.0.13.8-hotspot\bin;C:\Program Files\Eclipse Adoptium\jdk-17.0.1.12-hotspot\bin;C:\Program Files\AdoptOpenJDK\jre-16.0.1.9-hotspot\bin;C:\Program Files\Eclipse Adoptium\jdk-8.0.312.7-hotspot\bin;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\VSCodium\bin;C:\Program Files\Git\cmd;C:\Program Files\Go\bin;C:\Program Files\PowerShell\7\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin;%NVM_HOME%;%NVM_SYMLINK%;C:\Program Files (x86)\gsudo\;C:\Program Files\Sqlite;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files\texlive\2021\bin\win32;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files (x86)\dotnet\; \ No newline at end of file diff --git a/src/java_remote.rs b/src/java_remote.rs index a3fdba4..7708436 100644 --- a/src/java_remote.rs +++ b/src/java_remote.rs @@ -1,7 +1,8 @@ use crate::java_ver; -use download_rs::sync_download::Download; +use download_rs::async_download::Download; use json; use reqwest; +use console::Style; pub async fn list_remote() -> json::JsonValue { let url = String::from("https://api.adoptium.net/v3/info/available_releases?image_type=jdk&os=windows&page=0&release_type=ga&sort_order=ASC"); @@ -16,7 +17,9 @@ pub async fn get_remote(version: &str) { "https://api.adoptium.net/v3/assets/latest/{}/hotspot?vendor=eclipse", version ); - println!("{}", url); + let green = Style::new().green(); + let red = Style::new().red(); + //println!("{}", url); let request = reqwest::get(url).await.unwrap().text().await.unwrap(); let result = json::parse(&request).unwrap(); let mut i = 0; @@ -28,7 +31,7 @@ pub async fn get_remote(version: &str) { arch = "x32"; } while i < result.len() { - //println!("{}",result[i]["binary"].pretty(4)); + // println!("{}",result[i]["binary"].pretty(4)); if result[i]["binary"]["image_type"] == "jdk" && result[i]["binary"].has_key("package") && result[i]["binary"]["os"] == "windows" @@ -38,22 +41,22 @@ pub async fn get_remote(version: &str) { let version_name = result[i]["release_name"].to_string(); let version_list = java_ver::read_version(); if !version_list.contains(&version_name) { - println!("{}", file_name); + // println!("{}", file_name); let download_url = format!( "https://mirrors.tuna.tsinghua.edu.cn/AdoptOpenJDK/{}/jdk/x64/windows/{}", version, file_name ); - println!("{}", download_url); + // println!("{}", download_url); let mut current_location = std::env::current_exe().unwrap(); current_location.pop(); current_location.push("temp/"); let save_location = current_location.to_str().unwrap(); - println!("{}", save_location); + // println!("{}", save_location); let download = Download::new(&download_url, Some(save_location), None); - match download.download() { + match download.download_async().await { Ok(_) => { - println!("下载完成"); + println!("{}", green.apply_to("下载完成")); let mut java_location = std::env::current_exe().unwrap(); java_location.pop(); java_location.push("java/"); @@ -65,12 +68,16 @@ pub async fn get_remote(version: &str) { String::from(java_location.to_str().unwrap()), ); let file = String::from(save_location) + &file_name; - java_ver::version_record(std::path::Path::new(&file), java) + java_ver::version_record(std::path::Path::new(&file), java); + match std::fs::remove_file(std::path::Path::new(&file)) { + Ok(_) => println!("{}", green.apply_to("jdk install finish!")), + Err(e) => println!("{} temp file delete failed, {}", red.apply_to("Error"), e.to_string()) + } } - Err(e) => println!("下载出错:{}", e.to_string()), + Err(e) => println!("{} Download Failed, {}", red.apply_to("Error"), e.to_string()), }; } else { - println!("JDK already exist!"); + println!("{}JDK already exist!", red.apply_to("Error")); } } i += 1; diff --git a/src/java_ver.rs b/src/java_ver.rs index df1629e..1c09f45 100644 --- a/src/java_ver.rs +++ b/src/java_ver.rs @@ -1,4 +1,5 @@ use crate::utils::ziputil; +use console::Style; use serde::Deserialize; use serde::Serialize; use std::io::Write; @@ -44,7 +45,10 @@ struct Store { } pub fn read_version() -> Vec { - let contents = std::fs::read_to_string("./versions.toml").expect("Unable to load"); + let mut current_location = std::env::current_exe().unwrap(); + current_location.pop(); + current_location.push("versions.toml"); + let contents = std::fs::read_to_string(¤t_location).expect("Unable to load Version Files"); let store: Store = toml::from_str(&contents).unwrap(); let mut versions: Vec = Vec::new(); if let Some(list) = store.Java_Version { @@ -61,9 +65,12 @@ pub fn version_record(file: &Path, java_config: Java) { current_location.pop(); current_location.push("java/"); ziputil::extract(&file, ¤t_location); + let mut version_file = std::env::current_exe().unwrap(); + version_file.pop(); + version_file.push("versions.toml"); let mut file = std::fs::File::options() .append(true) - .open("./versions.toml") + .open(&version_file) .unwrap(); let mut list: Vec = Vec::new(); list.push(java_config); @@ -123,8 +130,14 @@ pub fn enable_version(version: &str) { let result = std::os::windows::fs::symlink_dir(&path, ¤t_location); match result { - Ok(_) => println!("Enable SUCCESS, JDK VERSION:{}", version), - Err(e) => println!("Enable FAILED, {}", e.to_string()), + Ok(_) => { + let green = Style::new().green(); + println!("{}, JDK VERSION:{}",green.apply_to("Enable SUCCESS"), version) + } + Err(e) =>{ + let red = Style::new().red(); + println!("{}, {}", red.apply_to("Enable FAILED") ,e.to_string()); + } } } } diff --git a/src/main.rs b/src/main.rs index b31b7a7..8f04a88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,7 @@ async fn main() { let matches = clap::App::new("java-version") .about("Manage Java Developer Kit Versions") .author("ZuoXichen") - .version("0.1.0") + .version("0.1.1") .subcommand( clap::App::new("list") .about("List local available JDKs") diff --git a/src/utils/ziputil.rs b/src/utils/ziputil.rs index 94774fa..32357e7 100644 --- a/src/utils/ziputil.rs +++ b/src/utils/ziputil.rs @@ -1,13 +1,21 @@ use std; use std::path::Path; use std::path::PathBuf; +use indicatif::ProgressStyle; use zip; +use indicatif::ProgressBar; +use console::Term; pub fn extract(files: &Path, current_location: &PathBuf) { + let file = std::fs::File::open(files).unwrap(); let mut archive = zip::ZipArchive::new(file).unwrap(); + let prograss = ProgressBar::new(archive.len().try_into().unwrap()); + prograss.set_style(ProgressStyle::default_bar() + .template("{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {bytes}/{total_bytes} ({eta})") + .progress_chars("#>-")); for i in 0..archive.len() { let mut file = archive.by_index(i).unwrap(); let mut outpath = match file.enclosed_name() { @@ -23,20 +31,23 @@ pub fn extract(files: &Path, current_location: &PathBuf) { { let comment = file.comment(); if !comment.is_empty() { - println!("File {} comment: {}", i, comment); + let outline = format!("File {} comment: {}", i, comment); + prograss.println(&outline); } } if (*file.name()).ends_with('/') { - println!("File {} extracted to \"{}\"", i, outpath.display()); + let outline = format!("File {} extracted to \"{}\"", i, outpath.display()); + prograss.println(&outline); std::fs::create_dir_all(&outpath).unwrap(); } else { - println!( + let outline = format!( "File {} extracted to \"{}\" ({} bytes)", i, outpath.display(), file.size() ); + prograss.println(&outline); if let Some(p) = outpath.parent() { if !p.exists() { std::fs::create_dir_all(&p).unwrap(); @@ -45,5 +56,7 @@ pub fn extract(files: &Path, current_location: &PathBuf) { let mut outfile = std::fs::File::create(&outpath).unwrap(); std::io::copy(&mut file, &mut outfile).unwrap(); } + prograss.inc(1) } + prograss.finish(); } diff --git a/versions.toml b/versions.toml index 84d0d12..41c84c1 100644 --- a/versions.toml +++ b/versions.toml @@ -1,9 +1,4 @@ [[Java_Version]] -full_version = "jdk-11.0.14.1+1" -jvm_variant = "Hotspot" -image_type = "jdk" -path = "C:\\Users\\m1333\\Documents\\Programming\\java-version\\target\\debug\\java/jdk-11.0.14.1+1" -[[Java_Version]] full_version = "jdk-16.0.2+7" jvm_variant = "Hotspot" image_type = "jdk"