diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..d79be99 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,33 @@ +name: Build and Check (w/ Clippy) +on: + - push +jobs: + clippy: + name: Run clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1.3.1 + with: + toolchain: stable + - name: Run clippy + run: cargo clippy -- -D warnings + build: + name: Build on ${{ matrix.target }} + runs-on: ${{ matrix.target }} + strategy: + matrix: + target: [windows-latest, macos-latest, ubuntu-latest] + steps: + - uses: actions/checkout@master + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1.3.1 + with: + toolchain: stable + - name: Compile + run: cargo build -r + - uses: actions/upload-artifact@v3 + with: + name: discloud-cli-${{ matrix.target }} + path: target \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 1817932..b2b6284 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -47,22 +47,13 @@ dependencies = [ "libc", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -83,22 +74,22 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.5.4", "object", "rustc-demangle", ] [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64ct" -version = "1.0.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" [[package]] name = "bitflags" @@ -117,9 +108,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byteorder" @@ -129,9 +120,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "bzip2" @@ -156,9 +147,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.73" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" dependencies = [ "jobserver", ] @@ -180,7 +171,7 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time 0.1.44", + "time 0.1.45", "wasm-bindgen", "winapi", ] @@ -202,14 +193,14 @@ dependencies = [ [[package]] name = "clap" -version = "4.0.26" +version = "4.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" +checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d" dependencies = [ - "atty", "bitflags", "clap_derive", "clap_lex", + "is-terminal", "once_cell", "strsim", "termcolor", @@ -237,6 +228,16 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "colored" version = "2.0.0" @@ -250,13 +251,13 @@ dependencies = [ [[package]] name = "console" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89eab4d20ce20cea182308bca13088fecea9c05f6776cf287205d41a0ed3c847" +checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c" dependencies = [ "encode_unicode", + "lazy_static", "libc", - "once_cell", "terminal_size", "unicode-width", "winapi", @@ -294,12 +295,11 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.11" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", - "once_cell", ] [[package]] @@ -312,6 +312,84 @@ dependencies = [ "typenum", ] +[[package]] +name = "cxx" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "debugid" version = "0.8.0" @@ -335,9 +413,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.3" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", "crypto-common", @@ -376,6 +454,7 @@ dependencies = [ "reqwest", "sentry", "serde", + "serde-enum-str", "spinners", "tracing", "tracing-subscriber", @@ -398,6 +477,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -409,12 +509,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.6.2", ] [[package]] @@ -434,42 +534,42 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-core", "futures-io", @@ -492,9 +592,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "libc", @@ -509,9 +609,9 @@ checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "h2" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ "bytes", "fnv", @@ -547,6 +647,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -598,9 +707,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" dependencies = [ "bytes", "futures-channel", @@ -622,9 +731,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ "http", "hyper", @@ -635,18 +744,34 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.47" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c495f162af0bf17656d0014a0eded5f3cd2f365fdd204548c2869db89359dc7" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", - "once_cell", "wasm-bindgen", "winapi", ] +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.3.0" @@ -659,9 +784,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.1" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", "hashbrown", @@ -676,32 +801,54 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "ipnet" -version = "2.5.0" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" + +[[package]] +name = "is-terminal" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330" +dependencies = [ + "hermit-abi 0.2.6", + "io-lifetimes", + "rustix", + "windows-sys", +] [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "jobserver" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.59" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" dependencies = [ "wasm-bindgen", ] @@ -714,9 +861,24 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.132" +version = "0.2.138" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" + +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "log" @@ -764,11 +926,20 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + [[package]] name = "mio" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", @@ -776,6 +947,16 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -797,20 +978,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_threads" -version = "0.1.6" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ + "hermit-abi 0.1.19", "libc", ] @@ -825,9 +997,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.14.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" @@ -837,9 +1009,15 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "os_str_bytes" -version = "6.3.0" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + +[[package]] +name = "overload" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "password-hash" @@ -884,15 +1062,15 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro-error" @@ -959,9 +1137,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] @@ -988,9 +1166,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" dependencies = [ "aho-corasick", "memchr", @@ -999,9 +1177,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remove_dir_all" @@ -1014,9 +1192,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.12" +version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" +checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ "base64", "bytes", @@ -1073,11 +1251,25 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustix" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustls" -version = "0.20.6" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" +checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" dependencies = [ "log", "ring", @@ -1115,6 +1307,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "sct" version = "0.7.0" @@ -1135,11 +1333,8 @@ dependencies = [ "reqwest", "rustls", "sentry-core", -<<<<<<< HEAD -======= "sentry-panic", "sentry-tracing", ->>>>>>> b222aa2 (feat: add `mods allow` command) "tokio", "ureq", "webpki-roots", @@ -1147,9 +1342,9 @@ dependencies = [ [[package]] name = "sentry-backtrace" -version = "0.27.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49bafa55eefc6dbc04c7dac91e8c8ab9e89e9414f3193c105cabd991bbc75134" +checksum = "afe4800806552aab314129761d5d3b3d422284eca3de2ab59e9fd133636cbd3d" dependencies = [ "backtrace", "once_cell", @@ -1171,12 +1366,10 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= name = "sentry-panic" -version = "0.27.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "696c74c5882d5a0d5b4a31d0ff3989b04da49be7983b7f52a52c667da5b480bf" +checksum = "0af37b8500f273e511ebd6eb0d342ff7937d64ce3f134764b2b4653112d48cb4" dependencies = [ "sentry-backtrace", "sentry-core", @@ -1184,9 +1377,9 @@ dependencies = [ [[package]] name = "sentry-tracing" -version = "0.27.0" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea50bcf843510179a7ba41c9fe4d83a8958e9f8adf707ec731ff999297536344" +checksum = "63fc83ec2cf38726bd18cb1943ff11555b07fd5034cb68b10958ab32e2863a1f" dependencies = [ "sentry-core", "tracing-core", @@ -1194,7 +1387,6 @@ dependencies = [ ] [[package]] ->>>>>>> b222aa2 (feat: add `mods allow` command) name = "sentry-types" version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1206,7 +1398,7 @@ dependencies = [ "serde", "serde_json", "thiserror", - "time 0.3.14", + "time 0.3.17", "url", "uuid", ] @@ -1220,6 +1412,36 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-attributes" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3aba2af3c3b9cd6f3a919056dac6005b71fceecc1cdfa65c4df3912f64e07e60" +dependencies = [ + "darling_core", + "serde-rename-rule", + "syn", +] + +[[package]] +name = "serde-enum-str" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a41bf2fc78a58589b9a6948bfc918c9b2dc918732f2ac14eed982ffb876b39" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "serde-attributes", + "syn", +] + +[[package]] +name = "serde-rename-rule" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd2930103714ccef4f1fe5b6a5f2b6fdcfe462a6c802464714bd41e5b5097c33" + [[package]] name = "serde_derive" version = "1.0.150" @@ -1233,9 +1455,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa", "ryu", @@ -1256,9 +1478,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006769ba83e921b3085caa8334186b00cf92b4cb1a6cf4632fbccc8eff5c7549" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", @@ -1267,9 +1489,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9db03534dff993187064c4e0c05a5708d2a9728ace9a8959b77bedf415dac5" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", @@ -1296,9 +1518,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" @@ -1407,18 +1629,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.34" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1b05ca9d106ba7d2e31a9dab4a64e7be2cce415321966ea3132c49a656e252" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.34" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8f2591983642de85c921015f3f070c665a197ed69e417af436115e3a1407487" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", @@ -1436,9 +1658,9 @@ dependencies = [ [[package]] name = "time" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", @@ -1447,21 +1669,30 @@ dependencies = [ [[package]] name = "time" -version = "0.3.14" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ "itoa", - "libc", - "num_threads", + "serde", + "time-core", "time-macros", ] +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + [[package]] name = "time-macros" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +dependencies = [ + "time-core", +] [[package]] name = "tinyvec" @@ -1480,9 +1711,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89797afd69d206ccd11fb0ea560a44bbb87731d020670e79416d442919257d42" +checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" dependencies = [ "autocfg", "bytes", @@ -1490,10 +1721,9 @@ dependencies = [ "memchr", "mio", "num_cpus", - "once_cell", "pin-project-lite", "socket2", - "winapi", + "windows-sys", ] [[package]] @@ -1529,9 +1759,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.36" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite", @@ -1541,9 +1771,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", @@ -1552,9 +1782,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ "once_cell", "valuable", @@ -1573,11 +1803,11 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60db860322da191b40952ad9affe65ea23e7dd6a5c442c2c42865810c6ab8e6b" +checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" dependencies = [ - "ansi_term", + "nu-ansi-term", "sharded-slab", "smallvec", "thread_local", @@ -1593,9 +1823,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unicase" @@ -1614,24 +1844,24 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-normalization" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" dependencies = [ "tinyvec", ] [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "untrusted" @@ -1669,9 +1899,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.1.2" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" +checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" dependencies = [ "getrandom", "serde", @@ -1724,9 +1954,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1734,9 +1964,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" dependencies = [ "bumpalo", "log", @@ -1749,9 +1979,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.32" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ "cfg-if", "js-sys", @@ -1761,9 +1991,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1771,9 +2001,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", @@ -1784,15 +2014,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.82" +version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" [[package]] name = "web-sys" -version = "0.3.59" +version = "0.3.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" dependencies = [ "js-sys", "wasm-bindgen", @@ -1810,9 +2040,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ "webpki", ] @@ -1850,46 +2080,60 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ + "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", "windows_i686_msvc", "windows_x86_64_gnu", + "windows_x86_64_gnullvm", "windows_x86_64_msvc", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" [[package]] name = "windows_i686_gnu" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" [[package]] name = "windows_i686_msvc" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" [[package]] name = "winreg" @@ -1922,7 +2166,7 @@ dependencies = [ "hmac", "pbkdf2", "sha1", - "time 0.3.14", + "time 0.3.17", "zstd", ] diff --git a/Cargo.toml b/Cargo.toml index bfcb556..7aa9aef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,10 +18,11 @@ colored = "2.0.0" dialoguer = "0.10.2" directories = "4.0.1" reqwest = { version = "0.11.12", features = ["blocking", "json", "multipart", "rustls-tls"], default-features=false } -sentry = {version = "0.29.1", default-features = false, features = ["rustls", "reqwest"]} +sentry = { version = "0.29.1", default-features = false, features = ["rustls", "reqwest", "tracing", "panic"] } serde = { version = "1.0.150", features = ["derive"] } +serde-enum-str = "0.2.5" spinners = "4.1.0" tracing = "0.1.36" tracing-subscriber = { version = "0.3.15" } walkdir = "2.3.2" -zip = "0.6.3" \ No newline at end of file +zip = "0.6.3" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 6a423bf..979fd85 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,3 @@ [toolchain] -channel = "1.63.0" +channel = "stable" +components = [ "clippy", "rustfmt" ] \ No newline at end of file diff --git a/src/commands/mod.rs b/src/commands.rs similarity index 92% rename from src/commands/mod.rs rename to src/commands.rs index 9193270..c37fd8f 100644 --- a/src/commands/mod.rs +++ b/src/commands.rs @@ -10,6 +10,7 @@ pub mod remove; pub mod restart; pub mod start; pub mod stop; +pub mod teams; pub mod upload; use colored::Colorize; use dialoguer::{theme::ColorfulTheme, Select}; @@ -40,7 +41,7 @@ use crate::entities::FetchError; pub fn expect_token() -> String { if crate::auth::validate_token() { log("Your token is valid!"); - return crate::auth::get_token().unwrap(); + crate::auth::get_token().unwrap() } else { err("Your token is invalid!"); std::process::exit(1); @@ -80,21 +81,21 @@ mod tests { #[test] fn log() { - let mut out = String::from("✔".green().bold().to_string()); + let mut out = "✔".green().bold().to_string(); out.push_str(" Some logs"); assert_eq!(super::format_log("Some logs"), out) } #[test] fn err() { - let mut out = String::from("✘".red().bold().to_string()); + let mut out = "X".red().bold().to_string(); out.push_str(" Some errors"); assert_eq!(super::format_err("Some errors"), out) } #[test] fn warn() { - let mut out = String::from("!".yellow().bold().to_string()); + let mut out = "!".yellow().bold().to_string(); out.push_str(" Some warnings"); assert_eq!(super::format_warn("Some warnings"), out) } diff --git a/src/commands/aboutme.rs b/src/commands/aboutme.rs index 329bbb2..23ca352 100644 --- a/src/commands/aboutme.rs +++ b/src/commands/aboutme.rs @@ -4,7 +4,7 @@ use colored::Colorize; #[tracing::instrument] pub fn aboutme() { let token = super::expect_token(); - match crate::entities::user::fetch_user(token.clone()) { + match crate::entities::user::fetch_user(token) { Ok(user) => { println!("ID: {}", user.user_id.bright_black()); println!("Plan: {}", color_plan(user.plan)); diff --git a/src/commands/apps.rs b/src/commands/apps.rs index b12ca5e..857854c 100644 --- a/src/commands/apps.rs +++ b/src/commands/apps.rs @@ -4,29 +4,28 @@ use crate::entities::FetchError; #[tracing::instrument] pub fn apps() { let token = super::expect_token(); - match crate::entities::app::App::fetch_all(token.clone()) { + match crate::entities::app::App::fetch_all(token) { Ok(apps) => { println!("Your apps:"); for app in apps { - println!("- {}: ({}) {}", app.name.green(), app.lang.yellow(), app.id.to_string().bright_black()); + println!( + "- {}: ({}) {}", + app.name.green(), + app.lang.yellow(), + app.id.to_string().bright_black() + ); } } - Err(err) => { - match err { - FetchError::APIReturnedError(code) =>{ - match code { - 404 => { - super::err("You don't have any apps. Use `discloud up` to upload one.") - } - _ => { - super::err(&err.to_string()); - } - } - } - err => { + Err(err) => match err { + FetchError::APIReturnedError(code) => match code { + 404 => super::err("You don't have any apps. Use `discloud up` to upload one."), + _ => { super::err(&err.to_string()); } + }, + err => { + super::err(&err.to_string()); } - } + }, } -} \ No newline at end of file +} diff --git a/src/commands/authstatus.rs b/src/commands/authstatus.rs index 2660f14..82061c0 100644 --- a/src/commands/authstatus.rs +++ b/src/commands/authstatus.rs @@ -6,9 +6,7 @@ pub fn authstatus() -> std::io::Result<()> { Ok(token) => { super::log("You're already logged in!\n"); let mut stars = String::new(); - for _ in 0..token.len() - 5 { - stars.push('*'); - } + stars.push_str(&"*".repeat(token.len() - 5)); super::log(&format!("Token: {}{}", &token[..5], stars)); super::check_token(); } diff --git a/src/commands/commit.rs b/src/commands/commit.rs index 629f5bb..fc1ebf9 100644 --- a/src/commands/commit.rs +++ b/src/commands/commit.rs @@ -66,10 +66,10 @@ where let mut f = File::open(path)?; f.read_to_end(&mut buffer)?; - zip.write_all(&*buffer)?; + zip.write_all(&buffer)?; buffer.clear(); println!("{}", "✔".green().bold()); - } else if name.as_os_str().len() != 0 { + } else if !name.as_os_str().is_empty() { zip.add_directory(name.to_str().unwrap(), options)?; } } @@ -88,7 +88,7 @@ fn zip_dir_to_file( } let writer = File::create(dst_file).unwrap(); - let walkdir = WalkDir::new(src_dir.to_string()); + let walkdir = WalkDir::new(src_dir); let it = walkdir.into_iter(); zip_dir( diff --git a/src/commands/init.rs b/src/commands/init.rs index 86b5848..8bb8521 100644 --- a/src/commands/init.rs +++ b/src/commands/init.rs @@ -1,7 +1,7 @@ use dialoguer::{theme::ColorfulTheme, Select}; fn vec_from_str(s: String) -> Vec { - s.split(",").map(|s| s.trim().into()).collect() + s.split(',').map(|s| s.trim().into()).collect() } #[derive(Default)] @@ -25,7 +25,7 @@ impl App { fn get_config(&self) -> String { match &self.typ { AppTyp::Site => { - if self.apt.len() > 0 { + if !self.apt.is_empty() { format!( "ID={}\nMAIN={}\nAUTORESTART={}\nRAM={}\nAPT={}\nTYPE=site\nVERSION=latest", self.subdomain, @@ -42,7 +42,7 @@ impl App { } } AppTyp::Bot => { - if self.apt.len() > 0 { + if !self.apt.is_empty() { format!("NAME={}\nAVATAR={}\nMAIN={}\nAUTORESTART={}\nRAM={}\nAPT={}\nTYPE=bot\nVERSION=latest", self.name, self.avatar, self.main, self.autorestart, self.ram, self.apt.join(",")) } else { format!("NAME={}\nAVATAR={}\nMAIN={}\nAUTORESTART={}\nRAM={}\nTYPE=bot\nVERSION=latest", self.name,self.avatar, self.main, self.autorestart, self.ram) @@ -60,7 +60,7 @@ pub fn init() -> std::io::Result<()> { let typ = Select::with_theme(&ColorfulTheme::default()) .with_prompt("Type") .default(0) - .items(&vec!["Bot", "Site"]) + .items(&["Bot", "Site"]) .interact()?; let mut app: App = Default::default(); match typ { @@ -96,7 +96,7 @@ pub fn init() -> std::io::Result<()> { .with_prompt("APT Packages") .allow_empty(true) .interact_text()?; - if apt.len() > 0 { + if !apt.is_empty() { app.apt = vec_from_str(apt); } std::fs::write("discloud.config", app.get_config())?; diff --git a/src/commands/login.rs b/src/commands/login.rs index 2bcede0..f024b97 100644 --- a/src/commands/login.rs +++ b/src/commands/login.rs @@ -3,7 +3,7 @@ use clap::*; pub fn login(matches: &ArgMatches) -> std::io::Result<()> { let token = matches.get_one::("token").unwrap().clone(); if let Err(err) = crate::auth::login(token) { - super::err(format!("Couldn't save the token: {}", err.kind().to_string()).as_str()); + super::err(format!("Couldn't save the token: {}", err.kind()).as_str()); Err(err) } else { super::log("Token saved successfully"); diff --git a/src/commands/logs.rs b/src/commands/logs.rs index 0c7d4a2..6742edd 100644 --- a/src/commands/logs.rs +++ b/src/commands/logs.rs @@ -1,12 +1,12 @@ use spinners::{Spinner, Spinners}; #[tracing::instrument] -pub fn logs(){ +pub fn logs() { let token = super::expect_token(); match super::ask_for_app(token.clone(), "show the logs") { Ok(app_id) => { let mut spinner = Spinner::new(Spinners::Bounce, "Downloading the logs".into()); - match crate::entities::app::App::get_logs(token.clone(), app_id) { + match crate::entities::app::App::get_logs(token, app_id) { Ok(logs) => { spinner.stop_with_message(logs); } @@ -15,11 +15,10 @@ pub fn logs(){ std::process::exit(1); } } - } Err(err) => { super::err(&format!("Couldn't fetch apps from api: {}", err)); std::process::exit(1); } } -} \ No newline at end of file +} diff --git a/src/commands/mods/mod.rs b/src/commands/mods.rs similarity index 80% rename from src/commands/mods/mod.rs rename to src/commands/mods.rs index eb6e90c..8de5e15 100644 --- a/src/commands/mods/mod.rs +++ b/src/commands/mods.rs @@ -1,5 +1,5 @@ pub mod add; -pub mod remove; pub mod allow; pub mod deny; -use super::*; \ No newline at end of file +pub mod remove; +use super::*; diff --git a/src/commands/mods/add.rs b/src/commands/mods/add.rs index dd83ae7..272ebb5 100644 --- a/src/commands/mods/add.rs +++ b/src/commands/mods/add.rs @@ -1,13 +1,31 @@ use spinners::Spinner; -use crate::{commands::{expect_token, ask_for_app}, entities::{moderator::{Mod, Feature}}}; +use crate::{ + commands::{ask_for_app, expect_token}, + entities::moderator::{Feature, Mod}, +}; #[tracing::instrument] pub fn add(id: u128) { let token = expect_token(); let app_id = crate::handle_result!(ask_for_app(token.clone(), "add a moderator")); - let mut spinner = Spinner::new(spinners::Spinners::Bounce, format!("Adding {} as a moderator", id)); - - let moderator = crate::handle_result!(Mod::new(token.clone(), id, app_id, vec![Feature::SeeLogs, Feature::Status]), spinner); - spinner.stop_with_message(super::format_log(&format!("Permissions {:?} have been given to {}", moderator.get_features(), id))); -} \ No newline at end of file + let mut spinner = Spinner::new( + spinners::Spinners::Bounce, + format!("Adding {} as a moderator", id), + ); + + let moderator = crate::handle_result!( + Mod::new( + token, + id, + app_id, + vec![Feature::SeeLogs, Feature::Status] + ), + spinner + ); + spinner.stop_with_message(super::format_log(&format!( + "Permissions {:?} have been given to {}", + moderator.get_features(), + id + ))); +} diff --git a/src/commands/mods/allow.rs b/src/commands/mods/allow.rs index e4274a0..55cabe6 100644 --- a/src/commands/mods/allow.rs +++ b/src/commands/mods/allow.rs @@ -2,18 +2,28 @@ use crate::entities::moderator::Feature; use spinners::*; pub fn allow(id: u128, features: Vec) { let token = super::expect_token(); - let app_id = crate::handle_result!(super::ask_for_app(token.clone(), "modify the mod's permissions")); + let app_id = crate::handle_result!(super::ask_for_app( + token.clone(), + "modify the mod's permissions" + )); let mut spinner = Spinner::new(Spinners::Pong, "Adding the permissions...".into()); - let moderator = crate::handle_result!(crate::entities::moderator::Mod::fetch_mod(token.clone(), id, app_id)); + let moderator = crate::handle_result!(crate::entities::moderator::Mod::fetch_mod( + token.clone(), + id, + app_id + )); match moderator { Some(mut moderator) => { let mut feats = moderator.get_features(); feats.append(&mut features.clone()); - crate::handle_result!(moderator.set_features(feats, token.clone()), spinner); - spinner.stop_with_message(super::format_log(&format!("{:?} were added successfully!", features))); - }, + crate::handle_result!(moderator.set_features(feats, token), spinner); + spinner.stop_with_message(super::format_log(&format!( + "{:?} were added successfully!", + features + ))); + } None => { spinner.stop_with_message(super::format_err("That moderator doesn't exist!")); } } -} \ No newline at end of file +} diff --git a/src/commands/mods/deny.rs b/src/commands/mods/deny.rs index 2b6b4e3..a05b3be 100644 --- a/src/commands/mods/deny.rs +++ b/src/commands/mods/deny.rs @@ -1,22 +1,39 @@ use crate::entities::moderator::Feature; use spinners::*; -fn subtract_vecs(v1: &Vec, v2: &Vec) -> Vec - where T: Eq + Clone +fn subtract_vecs(v1: &[T], v2: &[T]) -> Vec +where + T: Eq + Clone, { v1.iter().filter(|&x| !v2.contains(x)).cloned().collect() } pub fn deny(id: u128, features: Vec) { let token = super::expect_token(); - let app_id = crate::handle_result!(super::ask_for_app(token.clone(), "modify the mod's permissions")); + let app_id = crate::handle_result!(super::ask_for_app( + token.clone(), + "modify the mod's permissions" + )); let mut spinner = Spinner::new(Spinners::Toggle2, "Removing the permissions...".into()); - let moderator = crate::handle_result!(crate::entities::moderator::Mod::fetch_mod(token.clone(), id, app_id)); + let moderator = crate::handle_result!(crate::entities::moderator::Mod::fetch_mod( + token.clone(), + id, + app_id + )); match moderator { Some(mut moderator) => { - crate::handle_result!(moderator.set_features(subtract_vecs(&moderator.get_features(), &features), token.clone()), spinner); - spinner.stop_with_message(super::format_log(&format!("{:?} were removed successfully!", features))); - }, + crate::handle_result!( + moderator.set_features( + subtract_vecs(&moderator.get_features(), &features), + token + ), + spinner + ); + spinner.stop_with_message(super::format_log(&format!( + "{:?} were removed successfully!", + features + ))); + } None => { spinner.stop_with_message(super::format_err("That moderator doesn't exist!")); } } -} \ No newline at end of file +} diff --git a/src/commands/mods/remove.rs b/src/commands/mods/remove.rs index ab3ba75..c171a68 100644 --- a/src/commands/mods/remove.rs +++ b/src/commands/mods/remove.rs @@ -1,20 +1,26 @@ use spinners::Spinner; +use crate::handle_result; use crate::{ commands::{ask_for_app, expect_token}, - entities::{app::App, moderator::Mod} + entities::{app::App, moderator::Mod}, }; -use crate::handle_result; #[tracing::instrument] pub fn remove(id: u128) { let token = expect_token(); let app_id = handle_result!(ask_for_app(token.clone(), "remove the moderator")); - let mut spinner = Spinner::new(spinners::Spinners::Moon, format!("Sending {} to the moon", id)); + let mut spinner = Spinner::new( + spinners::Spinners::Moon, + format!("Sending {} to the moon", id), + ); let app = handle_result!(App::fetch(token.clone(), app_id), spinner); let moderator = handle_result!(Mod::fetch_mod(token.clone(), id, app_id), spinner); if let Some(moderator) = moderator { - handle_result!(moderator.remove(token.clone()), spinner); - spinner.stop_with_message(super::format_log(&format!("{} was removed from your app!", id))); + handle_result!(moderator.remove(token), spinner); + spinner.stop_with_message(super::format_log(&format!( + "{} was removed from your app!", + id + ))); } else { spinner.stop_with_message(super::format_err(&format!( "{} isn't a moderator on {} ({})", diff --git a/src/commands/remove.rs b/src/commands/remove.rs index 3d3ca28..e24e465 100644 --- a/src/commands/remove.rs +++ b/src/commands/remove.rs @@ -5,21 +5,20 @@ pub fn remove() { match super::ask_for_app(token.clone(), "delete") { Ok(app_id) => { let mut spinner = Spinner::new(Spinners::Flip, "Deleting your app".into()); - match crate::entities::app::App::delete(token.clone(), app_id) { + match crate::entities::app::App::delete(token, app_id) { Ok(()) => { - spinner.stop_with_message(super::format_log("Your app was successfully nuked!")); + spinner + .stop_with_message(super::format_log("Your app was successfully nuked!")); } Err(err) => { super::err(&format!("Couldn't delete your app: {}", err)); std::process::exit(1); } } - } Err(err) => { super::err(&format!("Couldn't fetch apps from api: {}", err)); std::process::exit(1); } } - -} \ No newline at end of file +} diff --git a/src/commands/restart.rs b/src/commands/restart.rs index 359beb9..428f645 100644 --- a/src/commands/restart.rs +++ b/src/commands/restart.rs @@ -5,7 +5,7 @@ pub fn restart() { match super::ask_for_app(token.clone(), "restart") { Ok(app_id) => { let mut spinner = Spinner::new(Spinners::Earth, "Restarting your app".into()); - match crate::entities::app::App::restart(token.clone(), app_id) { + match crate::entities::app::App::restart(token, app_id) { Ok(()) => { spinner.stop_with_message(super::format_log("Your app is up!")); } @@ -14,12 +14,10 @@ pub fn restart() { std::process::exit(1); } } - } Err(err) => { super::err(&format!("Couldn't fetch apps from api: {}", err)); std::process::exit(1); } } - } diff --git a/src/commands/start.rs b/src/commands/start.rs index 18ef507..18fc63d 100644 --- a/src/commands/start.rs +++ b/src/commands/start.rs @@ -5,7 +5,7 @@ pub fn start() { match super::ask_for_app(token.clone(), "start") { Ok(app_id) => { let mut spinner = Spinner::new(Spinners::Earth, "Starting your app".into()); - match crate::entities::app::App::start(token.clone(), app_id) { + match crate::entities::app::App::start(token, app_id) { Ok(()) => { spinner.stop_with_message(super::format_log("Your app is up!")); } @@ -14,12 +14,10 @@ pub fn start() { std::process::exit(1); } } - } Err(err) => { super::err(&format!("Couldn't fetch apps from api: {}", err)); std::process::exit(1); } } - } diff --git a/src/commands/stop.rs b/src/commands/stop.rs index 32642fb..ce9b694 100644 --- a/src/commands/stop.rs +++ b/src/commands/stop.rs @@ -5,7 +5,7 @@ pub fn stop() { match super::ask_for_app(token.clone(), "shutdown") { Ok(app_id) => { let mut spinner = Spinner::new(Spinners::Pong, "Shutting down your app".into()); - match crate::entities::app::App::stop(token.clone(), app_id) { + match crate::entities::app::App::stop(token, app_id) { Ok(()) => { spinner.stop_with_message(super::format_log("Your app is down!")); } @@ -14,12 +14,10 @@ pub fn stop() { std::process::exit(1); } } - } Err(err) => { super::err(&format!("Couldn't fetch apps from api: {}", err)); std::process::exit(1); } } - -} \ No newline at end of file +} diff --git a/src/commands/teams.rs b/src/commands/teams.rs new file mode 100644 index 0000000..7b11285 --- /dev/null +++ b/src/commands/teams.rs @@ -0,0 +1,2 @@ +pub mod apps; +use super::*; diff --git a/src/commands/teams/apps.rs b/src/commands/teams/apps.rs new file mode 100644 index 0000000..b45c17e --- /dev/null +++ b/src/commands/teams/apps.rs @@ -0,0 +1,31 @@ +use colored::Colorize; + +use crate::entities::FetchError; +#[tracing::instrument] +pub fn apps() { + let token = super::expect_token(); + match crate::entities::app::App::fetch_foreign_apps(token) { + Ok(apps) => { + println!("(Not) Your apps:"); + for app in apps { + println!( + "- {}: ({}) {}", + app.name.green(), + app.lang.yellow(), + app.id.to_string().bright_black() + ); + } + } + Err(err) => match err { + FetchError::APIReturnedError(code) => match code { + 404 => super::err("No one gave you permission to do stuff on their apps."), + _ => { + super::err(&err.to_string()); + } + }, + err => { + super::err(&err.to_string()); + } + }, + } +} diff --git a/src/commands/upload.rs b/src/commands/upload.rs index a83e758..471108b 100644 --- a/src/commands/upload.rs +++ b/src/commands/upload.rs @@ -58,10 +58,10 @@ where let mut f = File::open(path)?; f.read_to_end(&mut buffer)?; - zip.write_all(&*buffer)?; + zip.write_all(&buffer)?; buffer.clear(); println!("{}", "✔".green().bold()); - } else if name.as_os_str().len() != 0 { + } else if !name.as_os_str().is_empty() { zip.add_directory(name.to_str().unwrap(), options)?; } } @@ -79,7 +79,7 @@ fn zip_dir_to_file( } let writer = File::create(dst_file).unwrap(); - let walkdir = WalkDir::new(src_dir.to_string()); + let walkdir = WalkDir::new(src_dir); let it = walkdir.into_iter(); zip_dir( diff --git a/src/config_dir.rs b/src/config_dir.rs index 62486e5..caf3c32 100644 --- a/src/config_dir.rs +++ b/src/config_dir.rs @@ -2,16 +2,12 @@ use directories::ProjectDirs; /// Returns config base paths according to the conventions of the OS #[tracing::instrument] pub fn get_proj_dir() -> Option { - if let Some(proj_dirs) = ProjectDirs::from("com", "Discloud", "Discloud Cli") { - Some(proj_dirs.config_dir().to_path_buf()) - } else { - None - } + ProjectDirs::from("com", "Discloud", "Discloud Cli").map(|p| p.config_dir().to_path_buf()) } #[tracing::instrument] /// Pushes file to the path returned by get_proj_dir() pub fn get_path(file: &str) -> Option { let mut result = get_proj_dir()?; - result.push(file.to_string()); + result.push(file); Some(result) } diff --git a/src/entities/mod.rs b/src/entities.rs similarity index 68% rename from src/entities/mod.rs rename to src/entities.rs index 51f8798..03a5736 100644 --- a/src/entities/mod.rs +++ b/src/entities.rs @@ -8,15 +8,17 @@ pub enum FetchError { NotLoggedIn, FailedToConnect(reqwest::Error), APIReturnedError(u16), - FailedWithMessage(String) + FailedWithMessage(String), } impl Display for FetchError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::NotLoggedIn => f.write_str("not logged in"), Self::FailedToConnect(err) => f.write_str(&format!("failed to connect: {}", err)), - Self::APIReturnedError(status) => f.write_str(&format!("api returned code: {}", status)), - Self::FailedWithMessage(msg) => f.write_str(&msg), + Self::APIReturnedError(status) => { + f.write_str(&format!("api returned code: {}", status)) + } + Self::FailedWithMessage(msg) => f.write_str(msg), } } } diff --git a/src/entities/app.rs b/src/entities/app.rs index 1656a48..e451f02 100644 --- a/src/entities/app.rs +++ b/src/entities/app.rs @@ -14,7 +14,21 @@ pub struct App { pub lang: String, } impl App { - #[tracing::instrument] + // Fetches apps from /team instead of /app/all + pub fn fetch_foreign_apps(token: String) -> Result, FetchError> { + #[derive(Deserialize)] + struct AppsResponse { + pub apps: Vec, + } + let client = reqwest::blocking::Client::new(); + let req = client + .get(crate::api_url!("/team")) + .header("api-token", token); + match req.send() { + Ok(res) => Ok(res.json::().unwrap().apps), + Err(err) => Err(FetchError::FailedToConnect(err)), + } + } pub fn fetch_all(token: String) -> Result, FetchError> { #[derive(Deserialize)] struct AppsResponse { @@ -35,7 +49,6 @@ impl App { Err(err) => Err(FetchError::FailedToConnect(err)), } } - #[tracing::instrument] pub fn fetch(token: String, id: u128) -> Result { #[derive(Deserialize)] struct AppResponse { @@ -56,7 +69,6 @@ impl App { Err(err) => Err(FetchError::FailedToConnect(err)), } } - #[tracing::instrument] pub fn get_logs(token: String, id: u128) -> Result { #[derive(Deserialize)] struct Terminal { @@ -91,7 +103,6 @@ impl App { Err(err) => Err(FetchError::FailedToConnect(err)), } } - #[tracing::instrument] pub fn restart(token: String, id: u128) -> Result<(), FetchError> { let client = reqwest::blocking::Client::new(); let req = client @@ -108,7 +119,6 @@ impl App { Err(err) => Err(FetchError::FailedToConnect(err)), } } - #[tracing::instrument] pub fn start(token: String, id: u128) -> Result<(), FetchError> { let client = reqwest::blocking::Client::new(); let req = client @@ -125,7 +135,6 @@ impl App { Err(err) => Err(FetchError::FailedToConnect(err)), } } - #[tracing::instrument] pub fn stop(token: String, id: u128) -> Result<(), FetchError> { let client = reqwest::blocking::Client::new(); let req = client @@ -142,7 +151,6 @@ impl App { Err(err) => Err(FetchError::FailedToConnect(err)), } } - #[tracing::instrument] pub fn delete(token: String, id: u128) -> Result<(), FetchError> { let client = reqwest::blocking::Client::new(); let req = client diff --git a/src/entities/moderator.rs b/src/entities/moderator.rs index 7f3ddfa..dfd1894 100644 --- a/src/entities/moderator.rs +++ b/src/entities/moderator.rs @@ -46,7 +46,6 @@ pub struct Mod { app_id: u128, } impl Mod { - #[tracing::instrument] pub fn new( token: String, user_id: u128, @@ -65,7 +64,6 @@ impl Mod { pub fn id(&self) -> u128 { self.user_id.parse().unwrap() } - #[tracing::instrument] pub fn set_features( &mut self, permissions: Vec, @@ -96,7 +94,6 @@ impl Mod { Err(err) => Err(FetchError::FailedToConnect(err)), } } - #[tracing::instrument] pub fn fetch_mod( token: String, user_id: u128, @@ -140,7 +137,6 @@ impl Mod { self.features.clone() } /// Adds this moderator to the app - #[tracing::instrument] pub fn add(&self, token: String) -> Result<(), FetchError> { #[derive(Deserialize)] struct Response { @@ -167,7 +163,6 @@ impl Mod { } } - #[tracing::instrument] pub fn remove(self, token: String) -> Result<(), FetchError> { #[derive(Deserialize)] struct Response { diff --git a/src/main.rs b/src/main.rs index 6d044f8..3ebd528 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,8 +23,8 @@ fn main() -> std::io::Result<()> { .init(); fn parse_feature(feature: &str) -> Result { match feature { - "start" => Ok(Feature::Start), - "stop" => Ok(Feature::Stop), + "start" => Ok(Feature::Start), + "stop" => Ok(Feature::Stop), "restart" => Ok(Feature::Restart), "logs" => Ok(Feature::SeeLogs), "commit" => Ok(Feature::Commit), @@ -38,11 +38,7 @@ fn main() -> std::io::Result<()> { "https://0512a7bb28624cfc848cdad08f2186a7@sentry.discloudbot.com/3", sentry::ClientOptions { release: sentry::release_name!(), - traces_sample_rate: if cfg!(debug_assertions) { - 1.0 - } else { - 0.2 - }, + traces_sample_rate: if cfg!(debug_assertions) { 1.0 } else { 0.2 }, ..Default::default() }, )); @@ -125,6 +121,18 @@ fn main() -> std::io::Result<()> { .about("Shows information about you.") .alias("user") ) + .subcommand( + Command::new("teams") + .about("Allows to interact with other people's bots, you can use this once someone adds you as a moderator.") + .subcommand_required(true) + .arg_required_else_help(true) + .subcommand( + Command::new("apps") + .about("Shows all bots you have access to.") + .alias("ls") + .alias("list") + ) + ) .subcommand( Command::new("mods") .about("Manages your apps' mods") @@ -147,28 +155,24 @@ fn main() -> std::io::Result<()> { .about("Gives permissions to a moderator") .arg(Arg::new("id").value_parser(value_parser!(u128)).action(clap::ArgAction::Set) .required(true)) - .arg(Arg::new("to").value_parser(["to"]).action(clap::ArgAction::Set).required(true)) .arg( Arg::new("perm") .value_parser(parse_feature) .action(clap::ArgAction::Append) - .min_values(1) .required(true) ) ) .subcommand( Command::new("deny") .about("Removes permissions from a moderator") + .arg(Arg::new("id").value_parser(value_parser!(u128)).action(clap::ArgAction::Set) + .required(true)) .arg( Arg::new("perm") .value_parser(parse_feature) .action(clap::ArgAction::Append) - .min_values(1) .required(true) ) - .arg(Arg::new("to").value_parser(["to"]).action(clap::ArgAction::Set).required(true)) - .arg(Arg::new("id").value_parser(value_parser!(u128)).action(clap::ArgAction::Set) - .required(true)) ) .after_help("Be careful with what people you add and what permissions you give: With Great Power comes Great Responsability.") ); @@ -227,22 +231,34 @@ fn main() -> std::io::Result<()> { } Some(("deny", matches)) => { let id: u128 = *matches.get_one("id").unwrap(); - let features: Vec = matches.get_many("perm").unwrap() - .map(|perm: &Feature| perm.clone()) - .collect(); + let features: Vec = matches.get_many("perm").unwrap().cloned().collect(); commands::mods::deny::deny(id, features); Ok(()) } Some(("allow", matches)) => { let id: u128 = *matches.get_one("id").unwrap(); - let features: Vec = matches.get_many("perm").unwrap() - .map(|perm: &Feature| perm.clone()) - .collect(); + let features: Vec = matches.get_many("perm").unwrap().cloned().collect(); commands::mods::allow::allow(id, features); Ok(()) } - _ => panic!(), + cmd => { + eprintln!("{:#?} command is not implemented yet.", cmd.unwrap().0); + Ok(()) + } }, - _ => panic!(), + Some(("teams", matches)) => match matches.subcommand() { + Some(("apps", _)) => { + commands::teams::apps::apps(); + Ok(()) + } + cmd => { + eprintln!("{:#?} command is not implemented yet.", cmd.unwrap().0); + Ok(()) + } + }, + cmd => { + eprintln!("{:#?} command is not implemented yet.", cmd.unwrap().0); + Ok(()) + } } }