diff options
author | fxqnlr <[email protected]> | 2023-05-26 17:40:27 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-05-26 17:40:27 +0200 |
commit | 2d7e0a2fbf1c8a4187e2bf3fdcd592631ab273a0 (patch) | |
tree | cc8f3522670245775e4be7ac2a1e2ad4fd818c8f | |
parent | d8554e30029bf43dccce72e982784cd01857b0c4 (diff) | |
download | modlist-2d7e0a2fbf1c8a4187e2bf3fdcd592631ab273a0.tar modlist-2d7e0a2fbf1c8a4187e2bf3fdcd592631ab273a0.tar.gz modlist-2d7e0a2fbf1c8a4187e2bf3fdcd592631ab273a0.zip |
added full progress? cargo fmt
-rw-r--r-- | Cargo.lock | 325 | ||||
-rw-r--r-- | src/apis/modrinth.rs | 7 | ||||
-rw-r--r-- | src/commands/download.rs | 39 | ||||
-rw-r--r-- | src/commands/io.rs | 34 | ||||
-rw-r--r-- | src/commands/list.rs | 54 | ||||
-rw-r--r-- | src/commands/modification.rs | 114 | ||||
-rw-r--r-- | src/commands/update.rs | 95 | ||||
-rw-r--r-- | src/config.rs | 6 | ||||
-rw-r--r-- | src/db.rs | 41 | ||||
-rw-r--r-- | src/error.rs | 6 | ||||
-rw-r--r-- | src/files.rs | 77 | ||||
-rw-r--r-- | src/lib.rs | 46 | ||||
-rw-r--r-- | src/main.rs | 164 |
13 files changed, 526 insertions, 482 deletions
@@ -19,11 +19,11 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" | |||
19 | 19 | ||
20 | [[package]] | 20 | [[package]] |
21 | name = "ahash" | 21 | name = "ahash" |
22 | version = "0.7.6" | 22 | version = "0.8.3" |
23 | source = "registry+https://github.com/rust-lang/crates.io-index" | 23 | source = "registry+https://github.com/rust-lang/crates.io-index" |
24 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" | 24 | checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" |
25 | dependencies = [ | 25 | dependencies = [ |
26 | "getrandom", | 26 | "cfg-if", |
27 | "once_cell", | 27 | "once_cell", |
28 | "version_check", | 28 | "version_check", |
29 | ] | 29 | ] |
@@ -39,9 +39,9 @@ dependencies = [ | |||
39 | 39 | ||
40 | [[package]] | 40 | [[package]] |
41 | name = "anstream" | 41 | name = "anstream" |
42 | version = "0.3.1" | 42 | version = "0.3.2" |
43 | source = "registry+https://github.com/rust-lang/crates.io-index" | 43 | source = "registry+https://github.com/rust-lang/crates.io-index" |
44 | checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450" | 44 | checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" |
45 | dependencies = [ | 45 | dependencies = [ |
46 | "anstyle", | 46 | "anstyle", |
47 | "anstyle-parse", | 47 | "anstyle-parse", |
@@ -109,9 +109,9 @@ dependencies = [ | |||
109 | 109 | ||
110 | [[package]] | 110 | [[package]] |
111 | name = "base64" | 111 | name = "base64" |
112 | version = "0.21.0" | 112 | version = "0.21.2" |
113 | source = "registry+https://github.com/rust-lang/crates.io-index" | 113 | source = "registry+https://github.com/rust-lang/crates.io-index" |
114 | checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" | 114 | checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" |
115 | 115 | ||
116 | [[package]] | 116 | [[package]] |
117 | name = "bitflags" | 117 | name = "bitflags" |
@@ -121,15 +121,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" | |||
121 | 121 | ||
122 | [[package]] | 122 | [[package]] |
123 | name = "bitflags" | 123 | name = "bitflags" |
124 | version = "2.2.1" | 124 | version = "2.3.1" |
125 | source = "registry+https://github.com/rust-lang/crates.io-index" | 125 | source = "registry+https://github.com/rust-lang/crates.io-index" |
126 | checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813" | 126 | checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84" |
127 | 127 | ||
128 | [[package]] | 128 | [[package]] |
129 | name = "bumpalo" | 129 | name = "bumpalo" |
130 | version = "3.12.1" | 130 | version = "3.13.0" |
131 | source = "registry+https://github.com/rust-lang/crates.io-index" | 131 | source = "registry+https://github.com/rust-lang/crates.io-index" |
132 | checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" | 132 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" |
133 | 133 | ||
134 | [[package]] | 134 | [[package]] |
135 | name = "bytes" | 135 | name = "bytes" |
@@ -166,9 +166,9 @@ dependencies = [ | |||
166 | 166 | ||
167 | [[package]] | 167 | [[package]] |
168 | name = "clap" | 168 | name = "clap" |
169 | version = "4.2.4" | 169 | version = "4.3.0" |
170 | source = "registry+https://github.com/rust-lang/crates.io-index" | 170 | source = "registry+https://github.com/rust-lang/crates.io-index" |
171 | checksum = "956ac1f6381d8d82ab4684768f89c0ea3afe66925ceadb4eeb3fc452ffc55d62" | 171 | checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" |
172 | dependencies = [ | 172 | dependencies = [ |
173 | "clap_builder", | 173 | "clap_builder", |
174 | "clap_derive", | 174 | "clap_derive", |
@@ -177,9 +177,9 @@ dependencies = [ | |||
177 | 177 | ||
178 | [[package]] | 178 | [[package]] |
179 | name = "clap_builder" | 179 | name = "clap_builder" |
180 | version = "4.2.4" | 180 | version = "4.3.0" |
181 | source = "registry+https://github.com/rust-lang/crates.io-index" | 181 | source = "registry+https://github.com/rust-lang/crates.io-index" |
182 | checksum = "84080e799e54cff944f4b4a4b0e71630b0e0443b25b985175c7dddc1a859b749" | 182 | checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" |
183 | dependencies = [ | 183 | dependencies = [ |
184 | "anstream", | 184 | "anstream", |
185 | "anstyle", | 185 | "anstyle", |
@@ -190,40 +190,30 @@ dependencies = [ | |||
190 | 190 | ||
191 | [[package]] | 191 | [[package]] |
192 | name = "clap_complete" | 192 | name = "clap_complete" |
193 | version = "4.2.1" | 193 | version = "4.3.0" |
194 | source = "registry+https://github.com/rust-lang/crates.io-index" | 194 | source = "registry+https://github.com/rust-lang/crates.io-index" |
195 | checksum = "1a19591b2ab0e3c04b588a0e04ddde7b9eaa423646d1b4a8092879216bf47473" | 195 | checksum = "a04ddfaacc3bc9e6ea67d024575fafc2a813027cf374b8f24f7bc233c6b6be12" |
196 | dependencies = [ | 196 | dependencies = [ |
197 | "clap", | 197 | "clap", |
198 | ] | 198 | ] |
199 | 199 | ||
200 | [[package]] | 200 | [[package]] |
201 | name = "clap_derive" | 201 | name = "clap_derive" |
202 | version = "4.2.0" | 202 | version = "4.3.0" |
203 | source = "registry+https://github.com/rust-lang/crates.io-index" | 203 | source = "registry+https://github.com/rust-lang/crates.io-index" |
204 | checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" | 204 | checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" |
205 | dependencies = [ | 205 | dependencies = [ |
206 | "heck", | 206 | "heck", |
207 | "proc-macro2", | 207 | "proc-macro2", |
208 | "quote", | 208 | "quote", |
209 | "syn 2.0.15", | 209 | "syn", |
210 | ] | 210 | ] |
211 | 211 | ||
212 | [[package]] | 212 | [[package]] |
213 | name = "clap_lex" | 213 | name = "clap_lex" |
214 | version = "0.4.1" | 214 | version = "0.5.0" |
215 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
216 | checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" | ||
217 | |||
218 | [[package]] | ||
219 | name = "codespan-reporting" | ||
220 | version = "0.11.1" | ||
221 | source = "registry+https://github.com/rust-lang/crates.io-index" | 215 | source = "registry+https://github.com/rust-lang/crates.io-index" |
222 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" | 216 | checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" |
223 | dependencies = [ | ||
224 | "termcolor", | ||
225 | "unicode-width", | ||
226 | ] | ||
227 | 217 | ||
228 | [[package]] | 218 | [[package]] |
229 | name = "colorchoice" | 219 | name = "colorchoice" |
@@ -233,9 +223,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" | |||
233 | 223 | ||
234 | [[package]] | 224 | [[package]] |
235 | name = "console" | 225 | name = "console" |
236 | version = "0.15.6" | 226 | version = "0.15.7" |
237 | source = "registry+https://github.com/rust-lang/crates.io-index" | 227 | source = "registry+https://github.com/rust-lang/crates.io-index" |
238 | checksum = "d0525278dce688103060006713371cedbad27186c7d913f33d866b498da0f595" | 228 | checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" |
239 | dependencies = [ | 229 | dependencies = [ |
240 | "encode_unicode", | 230 | "encode_unicode", |
241 | "lazy_static", | 231 | "lazy_static", |
@@ -261,67 +251,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
261 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" | 251 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" |
262 | 252 | ||
263 | [[package]] | 253 | [[package]] |
264 | name = "cxx" | ||
265 | version = "1.0.94" | ||
266 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
267 | checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" | ||
268 | dependencies = [ | ||
269 | "cc", | ||
270 | "cxxbridge-flags", | ||
271 | "cxxbridge-macro", | ||
272 | "link-cplusplus", | ||
273 | ] | ||
274 | |||
275 | [[package]] | ||
276 | name = "cxx-build" | ||
277 | version = "1.0.94" | ||
278 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
279 | checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" | ||
280 | dependencies = [ | ||
281 | "cc", | ||
282 | "codespan-reporting", | ||
283 | "once_cell", | ||
284 | "proc-macro2", | ||
285 | "quote", | ||
286 | "scratch", | ||
287 | "syn 2.0.15", | ||
288 | ] | ||
289 | |||
290 | [[package]] | ||
291 | name = "cxxbridge-flags" | ||
292 | version = "1.0.94" | ||
293 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
294 | checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" | ||
295 | |||
296 | [[package]] | ||
297 | name = "cxxbridge-macro" | ||
298 | version = "1.0.94" | ||
299 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
300 | checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" | ||
301 | dependencies = [ | ||
302 | "proc-macro2", | ||
303 | "quote", | ||
304 | "syn 2.0.15", | ||
305 | ] | ||
306 | |||
307 | [[package]] | ||
308 | name = "dirs" | 254 | name = "dirs" |
309 | version = "5.0.0" | 255 | version = "5.0.1" |
310 | source = "registry+https://github.com/rust-lang/crates.io-index" | 256 | source = "registry+https://github.com/rust-lang/crates.io-index" |
311 | checksum = "dece029acd3353e3a58ac2e3eb3c8d6c35827a892edc6cc4138ef9c33df46ecd" | 257 | checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" |
312 | dependencies = [ | 258 | dependencies = [ |
313 | "dirs-sys", | 259 | "dirs-sys", |
314 | ] | 260 | ] |
315 | 261 | ||
316 | [[package]] | 262 | [[package]] |
317 | name = "dirs-sys" | 263 | name = "dirs-sys" |
318 | version = "0.4.0" | 264 | version = "0.4.1" |
319 | source = "registry+https://github.com/rust-lang/crates.io-index" | 265 | source = "registry+https://github.com/rust-lang/crates.io-index" |
320 | checksum = "04414300db88f70d74c5ff54e50f9e1d1737d9a5b90f53fcf2e95ca2a9ab554b" | 266 | checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" |
321 | dependencies = [ | 267 | dependencies = [ |
322 | "libc", | 268 | "libc", |
269 | "option-ext", | ||
323 | "redox_users", | 270 | "redox_users", |
324 | "windows-sys 0.45.0", | 271 | "windows-sys 0.48.0", |
325 | ] | 272 | ] |
326 | 273 | ||
327 | [[package]] | 274 | [[package]] |
@@ -450,7 +397,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" | |||
450 | dependencies = [ | 397 | dependencies = [ |
451 | "proc-macro2", | 398 | "proc-macro2", |
452 | "quote", | 399 | "quote", |
453 | "syn 2.0.15", | 400 | "syn", |
454 | ] | 401 | ] |
455 | 402 | ||
456 | [[package]] | 403 | [[package]] |
@@ -501,9 +448,9 @@ checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" | |||
501 | 448 | ||
502 | [[package]] | 449 | [[package]] |
503 | name = "h2" | 450 | name = "h2" |
504 | version = "0.3.18" | 451 | version = "0.3.19" |
505 | source = "registry+https://github.com/rust-lang/crates.io-index" | 452 | source = "registry+https://github.com/rust-lang/crates.io-index" |
506 | checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" | 453 | checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" |
507 | dependencies = [ | 454 | dependencies = [ |
508 | "bytes", | 455 | "bytes", |
509 | "fnv", | 456 | "fnv", |
@@ -523,17 +470,23 @@ name = "hashbrown" | |||
523 | version = "0.12.3" | 470 | version = "0.12.3" |
524 | source = "registry+https://github.com/rust-lang/crates.io-index" | 471 | source = "registry+https://github.com/rust-lang/crates.io-index" |
525 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" | 472 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" |
473 | |||
474 | [[package]] | ||
475 | name = "hashbrown" | ||
476 | version = "0.13.2" | ||
477 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
478 | checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" | ||
526 | dependencies = [ | 479 | dependencies = [ |
527 | "ahash", | 480 | "ahash", |
528 | ] | 481 | ] |
529 | 482 | ||
530 | [[package]] | 483 | [[package]] |
531 | name = "hashlink" | 484 | name = "hashlink" |
532 | version = "0.8.1" | 485 | version = "0.8.2" |
533 | source = "registry+https://github.com/rust-lang/crates.io-index" | 486 | source = "registry+https://github.com/rust-lang/crates.io-index" |
534 | checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" | 487 | checksum = "0761a1b9491c4f2e3d66aa0f62d0fba0af9a0e2852e4d48ea506632a4b56e6aa" |
535 | dependencies = [ | 488 | dependencies = [ |
536 | "hashbrown", | 489 | "hashbrown 0.13.2", |
537 | ] | 490 | ] |
538 | 491 | ||
539 | [[package]] | 492 | [[package]] |
@@ -644,12 +597,11 @@ dependencies = [ | |||
644 | 597 | ||
645 | [[package]] | 598 | [[package]] |
646 | name = "iana-time-zone-haiku" | 599 | name = "iana-time-zone-haiku" |
647 | version = "0.1.1" | 600 | version = "0.1.2" |
648 | source = "registry+https://github.com/rust-lang/crates.io-index" | 601 | source = "registry+https://github.com/rust-lang/crates.io-index" |
649 | checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" | 602 | checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" |
650 | dependencies = [ | 603 | dependencies = [ |
651 | "cxx", | 604 | "cc", |
652 | "cxx-build", | ||
653 | ] | 605 | ] |
654 | 606 | ||
655 | [[package]] | 607 | [[package]] |
@@ -669,7 +621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
669 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" | 621 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" |
670 | dependencies = [ | 622 | dependencies = [ |
671 | "autocfg", | 623 | "autocfg", |
672 | "hashbrown", | 624 | "hashbrown 0.12.3", |
673 | ] | 625 | ] |
674 | 626 | ||
675 | [[package]] | 627 | [[package]] |
@@ -695,9 +647,9 @@ dependencies = [ | |||
695 | 647 | ||
696 | [[package]] | 648 | [[package]] |
697 | name = "io-lifetimes" | 649 | name = "io-lifetimes" |
698 | version = "1.0.10" | 650 | version = "1.0.11" |
699 | source = "registry+https://github.com/rust-lang/crates.io-index" | 651 | source = "registry+https://github.com/rust-lang/crates.io-index" |
700 | checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" | 652 | checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" |
701 | dependencies = [ | 653 | dependencies = [ |
702 | "hermit-abi 0.3.1", | 654 | "hermit-abi 0.3.1", |
703 | "libc", | 655 | "libc", |
@@ -730,9 +682,9 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" | |||
730 | 682 | ||
731 | [[package]] | 683 | [[package]] |
732 | name = "js-sys" | 684 | name = "js-sys" |
733 | version = "0.3.61" | 685 | version = "0.3.63" |
734 | source = "registry+https://github.com/rust-lang/crates.io-index" | 686 | source = "registry+https://github.com/rust-lang/crates.io-index" |
735 | checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" | 687 | checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" |
736 | dependencies = [ | 688 | dependencies = [ |
737 | "wasm-bindgen", | 689 | "wasm-bindgen", |
738 | ] | 690 | ] |
@@ -745,9 +697,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" | |||
745 | 697 | ||
746 | [[package]] | 698 | [[package]] |
747 | name = "libc" | 699 | name = "libc" |
748 | version = "0.2.142" | 700 | version = "0.2.144" |
749 | source = "registry+https://github.com/rust-lang/crates.io-index" | 701 | source = "registry+https://github.com/rust-lang/crates.io-index" |
750 | checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" | 702 | checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" |
751 | 703 | ||
752 | [[package]] | 704 | [[package]] |
753 | name = "libsqlite3-sys" | 705 | name = "libsqlite3-sys" |
@@ -761,19 +713,10 @@ dependencies = [ | |||
761 | ] | 713 | ] |
762 | 714 | ||
763 | [[package]] | 715 | [[package]] |
764 | name = "link-cplusplus" | ||
765 | version = "1.0.8" | ||
766 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
767 | checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" | ||
768 | dependencies = [ | ||
769 | "cc", | ||
770 | ] | ||
771 | |||
772 | [[package]] | ||
773 | name = "linux-raw-sys" | 716 | name = "linux-raw-sys" |
774 | version = "0.3.4" | 717 | version = "0.3.8" |
775 | source = "registry+https://github.com/rust-lang/crates.io-index" | 718 | source = "registry+https://github.com/rust-lang/crates.io-index" |
776 | checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf" | 719 | checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" |
777 | 720 | ||
778 | [[package]] | 721 | [[package]] |
779 | name = "lock_api" | 722 | name = "lock_api" |
@@ -937,7 +880,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" | |||
937 | dependencies = [ | 880 | dependencies = [ |
938 | "proc-macro2", | 881 | "proc-macro2", |
939 | "quote", | 882 | "quote", |
940 | "syn 2.0.15", | 883 | "syn", |
941 | ] | 884 | ] |
942 | 885 | ||
943 | [[package]] | 886 | [[package]] |
@@ -959,6 +902,12 @@ dependencies = [ | |||
959 | ] | 902 | ] |
960 | 903 | ||
961 | [[package]] | 904 | [[package]] |
905 | name = "option-ext" | ||
906 | version = "0.2.0" | ||
907 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
908 | checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" | ||
909 | |||
910 | [[package]] | ||
962 | name = "parking_lot" | 911 | name = "parking_lot" |
963 | version = "0.12.1" | 912 | version = "0.12.1" |
964 | source = "registry+https://github.com/rust-lang/crates.io-index" | 913 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1001,9 +950,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" | |||
1001 | 950 | ||
1002 | [[package]] | 951 | [[package]] |
1003 | name = "pkg-config" | 952 | name = "pkg-config" |
1004 | version = "0.3.26" | 953 | version = "0.3.27" |
1005 | source = "registry+https://github.com/rust-lang/crates.io-index" | 954 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1006 | checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" | 955 | checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" |
1007 | 956 | ||
1008 | [[package]] | 957 | [[package]] |
1009 | name = "portable-atomic" | 958 | name = "portable-atomic" |
@@ -1022,18 +971,18 @@ checksum = "dc59d1bcc64fc5d021d67521f818db868368028108d37f0e98d74e33f68297b5" | |||
1022 | 971 | ||
1023 | [[package]] | 972 | [[package]] |
1024 | name = "proc-macro2" | 973 | name = "proc-macro2" |
1025 | version = "1.0.56" | 974 | version = "1.0.59" |
1026 | source = "registry+https://github.com/rust-lang/crates.io-index" | 975 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1027 | checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" | 976 | checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" |
1028 | dependencies = [ | 977 | dependencies = [ |
1029 | "unicode-ident", | 978 | "unicode-ident", |
1030 | ] | 979 | ] |
1031 | 980 | ||
1032 | [[package]] | 981 | [[package]] |
1033 | name = "quote" | 982 | name = "quote" |
1034 | version = "1.0.26" | 983 | version = "1.0.28" |
1035 | source = "registry+https://github.com/rust-lang/crates.io-index" | 984 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1036 | checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" | 985 | checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" |
1037 | dependencies = [ | 986 | dependencies = [ |
1038 | "proc-macro2", | 987 | "proc-macro2", |
1039 | ] | 988 | ] |
@@ -1069,9 +1018,9 @@ dependencies = [ | |||
1069 | 1018 | ||
1070 | [[package]] | 1019 | [[package]] |
1071 | name = "reqwest" | 1020 | name = "reqwest" |
1072 | version = "0.11.16" | 1021 | version = "0.11.18" |
1073 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1022 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1074 | checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" | 1023 | checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" |
1075 | dependencies = [ | 1024 | dependencies = [ |
1076 | "base64", | 1025 | "base64", |
1077 | "bytes", | 1026 | "bytes", |
@@ -1112,7 +1061,7 @@ version = "0.29.0" | |||
1112 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1061 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1113 | checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" | 1062 | checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" |
1114 | dependencies = [ | 1063 | dependencies = [ |
1115 | "bitflags 2.2.1", | 1064 | "bitflags 2.3.1", |
1116 | "fallible-iterator", | 1065 | "fallible-iterator", |
1117 | "fallible-streaming-iterator", | 1066 | "fallible-streaming-iterator", |
1118 | "hashlink", | 1067 | "hashlink", |
@@ -1128,9 +1077,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" | |||
1128 | 1077 | ||
1129 | [[package]] | 1078 | [[package]] |
1130 | name = "rustix" | 1079 | name = "rustix" |
1131 | version = "0.37.15" | 1080 | version = "0.37.19" |
1132 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1081 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1133 | checksum = "a0661814f891c57c930a610266415528da53c4933e6dea5fb350cbfe048a9ece" | 1082 | checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" |
1134 | dependencies = [ | 1083 | dependencies = [ |
1135 | "bitflags 1.3.2", | 1084 | "bitflags 1.3.2", |
1136 | "errno", | 1085 | "errno", |
@@ -1162,16 +1111,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1162 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" | 1111 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" |
1163 | 1112 | ||
1164 | [[package]] | 1113 | [[package]] |
1165 | name = "scratch" | ||
1166 | version = "1.0.5" | ||
1167 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1168 | checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" | ||
1169 | |||
1170 | [[package]] | ||
1171 | name = "security-framework" | 1114 | name = "security-framework" |
1172 | version = "2.8.2" | 1115 | version = "2.9.1" |
1173 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1116 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1174 | checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" | 1117 | checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" |
1175 | dependencies = [ | 1118 | dependencies = [ |
1176 | "bitflags 1.3.2", | 1119 | "bitflags 1.3.2", |
1177 | "core-foundation", | 1120 | "core-foundation", |
@@ -1182,9 +1125,9 @@ dependencies = [ | |||
1182 | 1125 | ||
1183 | [[package]] | 1126 | [[package]] |
1184 | name = "security-framework-sys" | 1127 | name = "security-framework-sys" |
1185 | version = "2.8.0" | 1128 | version = "2.9.0" |
1186 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1129 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1187 | checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" | 1130 | checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" |
1188 | dependencies = [ | 1131 | dependencies = [ |
1189 | "core-foundation-sys", | 1132 | "core-foundation-sys", |
1190 | "libc", | 1133 | "libc", |
@@ -1192,22 +1135,22 @@ dependencies = [ | |||
1192 | 1135 | ||
1193 | [[package]] | 1136 | [[package]] |
1194 | name = "serde" | 1137 | name = "serde" |
1195 | version = "1.0.160" | 1138 | version = "1.0.163" |
1196 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1197 | checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" | 1140 | checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" |
1198 | dependencies = [ | 1141 | dependencies = [ |
1199 | "serde_derive", | 1142 | "serde_derive", |
1200 | ] | 1143 | ] |
1201 | 1144 | ||
1202 | [[package]] | 1145 | [[package]] |
1203 | name = "serde_derive" | 1146 | name = "serde_derive" |
1204 | version = "1.0.160" | 1147 | version = "1.0.163" |
1205 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1148 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1206 | checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" | 1149 | checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" |
1207 | dependencies = [ | 1150 | dependencies = [ |
1208 | "proc-macro2", | 1151 | "proc-macro2", |
1209 | "quote", | 1152 | "quote", |
1210 | "syn 2.0.15", | 1153 | "syn", |
1211 | ] | 1154 | ] |
1212 | 1155 | ||
1213 | [[package]] | 1156 | [[package]] |
@@ -1223,9 +1166,9 @@ dependencies = [ | |||
1223 | 1166 | ||
1224 | [[package]] | 1167 | [[package]] |
1225 | name = "serde_spanned" | 1168 | name = "serde_spanned" |
1226 | version = "0.6.1" | 1169 | version = "0.6.2" |
1227 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1170 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1228 | checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" | 1171 | checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" |
1229 | dependencies = [ | 1172 | dependencies = [ |
1230 | "serde", | 1173 | "serde", |
1231 | ] | 1174 | ] |
@@ -1284,20 +1227,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" | |||
1284 | 1227 | ||
1285 | [[package]] | 1228 | [[package]] |
1286 | name = "syn" | 1229 | name = "syn" |
1287 | version = "1.0.109" | 1230 | version = "2.0.17" |
1288 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1231 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1289 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" | 1232 | checksum = "45b6ddbb36c5b969c182aec3c4a0bce7df3fbad4b77114706a49aacc80567388" |
1290 | dependencies = [ | ||
1291 | "proc-macro2", | ||
1292 | "quote", | ||
1293 | "unicode-ident", | ||
1294 | ] | ||
1295 | |||
1296 | [[package]] | ||
1297 | name = "syn" | ||
1298 | version = "2.0.15" | ||
1299 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1300 | checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" | ||
1301 | dependencies = [ | 1233 | dependencies = [ |
1302 | "proc-macro2", | 1234 | "proc-macro2", |
1303 | "quote", | 1235 | "quote", |
@@ -1318,15 +1250,6 @@ dependencies = [ | |||
1318 | ] | 1250 | ] |
1319 | 1251 | ||
1320 | [[package]] | 1252 | [[package]] |
1321 | name = "termcolor" | ||
1322 | version = "1.2.0" | ||
1323 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1324 | checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" | ||
1325 | dependencies = [ | ||
1326 | "winapi-util", | ||
1327 | ] | ||
1328 | |||
1329 | [[package]] | ||
1330 | name = "thiserror" | 1253 | name = "thiserror" |
1331 | version = "1.0.40" | 1254 | version = "1.0.40" |
1332 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1255 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1343,7 +1266,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" | |||
1343 | dependencies = [ | 1266 | dependencies = [ |
1344 | "proc-macro2", | 1267 | "proc-macro2", |
1345 | "quote", | 1268 | "quote", |
1346 | "syn 2.0.15", | 1269 | "syn", |
1347 | ] | 1270 | ] |
1348 | 1271 | ||
1349 | [[package]] | 1272 | [[package]] |
@@ -1374,9 +1297,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" | |||
1374 | 1297 | ||
1375 | [[package]] | 1298 | [[package]] |
1376 | name = "tokio" | 1299 | name = "tokio" |
1377 | version = "1.28.0" | 1300 | version = "1.28.1" |
1378 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1301 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1379 | checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" | 1302 | checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" |
1380 | dependencies = [ | 1303 | dependencies = [ |
1381 | "autocfg", | 1304 | "autocfg", |
1382 | "bytes", | 1305 | "bytes", |
@@ -1399,7 +1322,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" | |||
1399 | dependencies = [ | 1322 | dependencies = [ |
1400 | "proc-macro2", | 1323 | "proc-macro2", |
1401 | "quote", | 1324 | "quote", |
1402 | "syn 2.0.15", | 1325 | "syn", |
1403 | ] | 1326 | ] |
1404 | 1327 | ||
1405 | [[package]] | 1328 | [[package]] |
@@ -1428,9 +1351,9 @@ dependencies = [ | |||
1428 | 1351 | ||
1429 | [[package]] | 1352 | [[package]] |
1430 | name = "toml" | 1353 | name = "toml" |
1431 | version = "0.7.3" | 1354 | version = "0.7.4" |
1432 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1355 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1433 | checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" | 1356 | checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" |
1434 | dependencies = [ | 1357 | dependencies = [ |
1435 | "serde", | 1358 | "serde", |
1436 | "serde_spanned", | 1359 | "serde_spanned", |
@@ -1440,18 +1363,18 @@ dependencies = [ | |||
1440 | 1363 | ||
1441 | [[package]] | 1364 | [[package]] |
1442 | name = "toml_datetime" | 1365 | name = "toml_datetime" |
1443 | version = "0.6.1" | 1366 | version = "0.6.2" |
1444 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1367 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1445 | checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" | 1368 | checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" |
1446 | dependencies = [ | 1369 | dependencies = [ |
1447 | "serde", | 1370 | "serde", |
1448 | ] | 1371 | ] |
1449 | 1372 | ||
1450 | [[package]] | 1373 | [[package]] |
1451 | name = "toml_edit" | 1374 | name = "toml_edit" |
1452 | version = "0.19.8" | 1375 | version = "0.19.10" |
1453 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1376 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1454 | checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" | 1377 | checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" |
1455 | dependencies = [ | 1378 | dependencies = [ |
1456 | "indexmap", | 1379 | "indexmap", |
1457 | "serde", | 1380 | "serde", |
@@ -1468,19 +1391,20 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" | |||
1468 | 1391 | ||
1469 | [[package]] | 1392 | [[package]] |
1470 | name = "tracing" | 1393 | name = "tracing" |
1471 | version = "0.1.38" | 1394 | version = "0.1.37" |
1472 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1395 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1473 | checksum = "cf9cf6a813d3f40c88b0b6b6f29a5c95c6cdbf97c1f9cc53fb820200f5ad814d" | 1396 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" |
1474 | dependencies = [ | 1397 | dependencies = [ |
1398 | "cfg-if", | ||
1475 | "pin-project-lite", | 1399 | "pin-project-lite", |
1476 | "tracing-core", | 1400 | "tracing-core", |
1477 | ] | 1401 | ] |
1478 | 1402 | ||
1479 | [[package]] | 1403 | [[package]] |
1480 | name = "tracing-core" | 1404 | name = "tracing-core" |
1481 | version = "0.1.30" | 1405 | version = "0.1.31" |
1482 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1406 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1483 | checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" | 1407 | checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" |
1484 | dependencies = [ | 1408 | dependencies = [ |
1485 | "once_cell", | 1409 | "once_cell", |
1486 | ] | 1410 | ] |
@@ -1499,9 +1423,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" | |||
1499 | 1423 | ||
1500 | [[package]] | 1424 | [[package]] |
1501 | name = "unicode-ident" | 1425 | name = "unicode-ident" |
1502 | version = "1.0.8" | 1426 | version = "1.0.9" |
1503 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1427 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1504 | checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" | 1428 | checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" |
1505 | 1429 | ||
1506 | [[package]] | 1430 | [[package]] |
1507 | name = "unicode-normalization" | 1431 | name = "unicode-normalization" |
@@ -1571,9 +1495,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" | |||
1571 | 1495 | ||
1572 | [[package]] | 1496 | [[package]] |
1573 | name = "wasm-bindgen" | 1497 | name = "wasm-bindgen" |
1574 | version = "0.2.84" | 1498 | version = "0.2.86" |
1575 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1499 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1576 | checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" | 1500 | checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" |
1577 | dependencies = [ | 1501 | dependencies = [ |
1578 | "cfg-if", | 1502 | "cfg-if", |
1579 | "wasm-bindgen-macro", | 1503 | "wasm-bindgen-macro", |
@@ -1581,24 +1505,24 @@ dependencies = [ | |||
1581 | 1505 | ||
1582 | [[package]] | 1506 | [[package]] |
1583 | name = "wasm-bindgen-backend" | 1507 | name = "wasm-bindgen-backend" |
1584 | version = "0.2.84" | 1508 | version = "0.2.86" |
1585 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1509 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1586 | checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" | 1510 | checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" |
1587 | dependencies = [ | 1511 | dependencies = [ |
1588 | "bumpalo", | 1512 | "bumpalo", |
1589 | "log", | 1513 | "log", |
1590 | "once_cell", | 1514 | "once_cell", |
1591 | "proc-macro2", | 1515 | "proc-macro2", |
1592 | "quote", | 1516 | "quote", |
1593 | "syn 1.0.109", | 1517 | "syn", |
1594 | "wasm-bindgen-shared", | 1518 | "wasm-bindgen-shared", |
1595 | ] | 1519 | ] |
1596 | 1520 | ||
1597 | [[package]] | 1521 | [[package]] |
1598 | name = "wasm-bindgen-futures" | 1522 | name = "wasm-bindgen-futures" |
1599 | version = "0.4.34" | 1523 | version = "0.4.36" |
1600 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1524 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1601 | checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" | 1525 | checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" |
1602 | dependencies = [ | 1526 | dependencies = [ |
1603 | "cfg-if", | 1527 | "cfg-if", |
1604 | "js-sys", | 1528 | "js-sys", |
@@ -1608,9 +1532,9 @@ dependencies = [ | |||
1608 | 1532 | ||
1609 | [[package]] | 1533 | [[package]] |
1610 | name = "wasm-bindgen-macro" | 1534 | name = "wasm-bindgen-macro" |
1611 | version = "0.2.84" | 1535 | version = "0.2.86" |
1612 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1536 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1613 | checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" | 1537 | checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" |
1614 | dependencies = [ | 1538 | dependencies = [ |
1615 | "quote", | 1539 | "quote", |
1616 | "wasm-bindgen-macro-support", | 1540 | "wasm-bindgen-macro-support", |
@@ -1618,22 +1542,22 @@ dependencies = [ | |||
1618 | 1542 | ||
1619 | [[package]] | 1543 | [[package]] |
1620 | name = "wasm-bindgen-macro-support" | 1544 | name = "wasm-bindgen-macro-support" |
1621 | version = "0.2.84" | 1545 | version = "0.2.86" |
1622 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1546 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1623 | checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" | 1547 | checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" |
1624 | dependencies = [ | 1548 | dependencies = [ |
1625 | "proc-macro2", | 1549 | "proc-macro2", |
1626 | "quote", | 1550 | "quote", |
1627 | "syn 1.0.109", | 1551 | "syn", |
1628 | "wasm-bindgen-backend", | 1552 | "wasm-bindgen-backend", |
1629 | "wasm-bindgen-shared", | 1553 | "wasm-bindgen-shared", |
1630 | ] | 1554 | ] |
1631 | 1555 | ||
1632 | [[package]] | 1556 | [[package]] |
1633 | name = "wasm-bindgen-shared" | 1557 | name = "wasm-bindgen-shared" |
1634 | version = "0.2.84" | 1558 | version = "0.2.86" |
1635 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1559 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1636 | checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" | 1560 | checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" |
1637 | 1561 | ||
1638 | [[package]] | 1562 | [[package]] |
1639 | name = "wasm-streams" | 1563 | name = "wasm-streams" |
@@ -1650,9 +1574,9 @@ dependencies = [ | |||
1650 | 1574 | ||
1651 | [[package]] | 1575 | [[package]] |
1652 | name = "web-sys" | 1576 | name = "web-sys" |
1653 | version = "0.3.61" | 1577 | version = "0.3.63" |
1654 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1578 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1655 | checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" | 1579 | checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" |
1656 | dependencies = [ | 1580 | dependencies = [ |
1657 | "js-sys", | 1581 | "js-sys", |
1658 | "wasm-bindgen", | 1582 | "wasm-bindgen", |
@@ -1675,15 +1599,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1675 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | 1599 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" |
1676 | 1600 | ||
1677 | [[package]] | 1601 | [[package]] |
1678 | name = "winapi-util" | ||
1679 | version = "0.1.5" | ||
1680 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1681 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" | ||
1682 | dependencies = [ | ||
1683 | "winapi", | ||
1684 | ] | ||
1685 | |||
1686 | [[package]] | ||
1687 | name = "winapi-x86_64-pc-windows-gnu" | 1602 | name = "winapi-x86_64-pc-windows-gnu" |
1688 | version = "0.4.0" | 1603 | version = "0.4.0" |
1689 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1604 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1847,9 +1762,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" | |||
1847 | 1762 | ||
1848 | [[package]] | 1763 | [[package]] |
1849 | name = "winnow" | 1764 | name = "winnow" |
1850 | version = "0.4.1" | 1765 | version = "0.4.6" |
1851 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1766 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1852 | checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" | 1767 | checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" |
1853 | dependencies = [ | 1768 | dependencies = [ |
1854 | "memchr", | 1769 | "memchr", |
1855 | ] | 1770 | ] |
diff --git a/src/apis/modrinth.rs b/src/apis/modrinth.rs index 14ff266..fb3952d 100644 --- a/src/apis/modrinth.rs +++ b/src/apis/modrinth.rs | |||
@@ -127,7 +127,7 @@ pub enum GameVersionType { | |||
127 | release, | 127 | release, |
128 | snapshot, | 128 | snapshot, |
129 | alpha, | 129 | alpha, |
130 | beta | 130 | beta, |
131 | } | 131 | } |
132 | 132 | ||
133 | async fn get(api: &str, path: &str) -> Result<Option<Vec<u8>>, Box<dyn std::error::Error>> { | 133 | async fn get(api: &str, path: &str) -> Result<Option<Vec<u8>>, Box<dyn std::error::Error>> { |
@@ -208,7 +208,10 @@ pub fn extract_current_version(versions: Vec<Version>) -> MLE<String> { | |||
208 | } | 208 | } |
209 | 209 | ||
210 | pub async fn get_game_versions() -> Vec<GameVersion> { | 210 | pub async fn get_game_versions() -> Vec<GameVersion> { |
211 | let data = get("https://api.modrinth.com/v2/", "tag/game_version").await.unwrap().unwrap(); | 211 | let data = get("https://api.modrinth.com/v2/", "tag/game_version") |
212 | .await | ||
213 | .unwrap() | ||
214 | .unwrap(); | ||
212 | 215 | ||
213 | serde_json::from_slice(&data).unwrap() | 216 | serde_json::from_slice(&data).unwrap() |
214 | } | 217 | } |
diff --git a/src/commands/download.rs b/src/commands/download.rs index 7aa0156..dd00ffb 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs | |||
@@ -1,7 +1,5 @@ | |||
1 | use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; | ||
1 | 2 | ||
2 | use indicatif::{MultiProgress, ProgressStyle, ProgressBar}; | ||
3 | |||
4 | use crate::{STYLE_BAR_POS, PROGRESS_CHARS}; | ||
5 | use crate::{config::Cfg, List}; | 3 | use crate::{config::Cfg, List}; |
6 | use crate::{ | 4 | use crate::{ |
7 | db::userlist_get_all_current_versions_with_mods, | 5 | db::userlist_get_all_current_versions_with_mods, |
@@ -11,12 +9,21 @@ use crate::{ | |||
11 | }, | 9 | }, |
12 | modrinth::get_raw_versions, | 10 | modrinth::get_raw_versions, |
13 | }; | 11 | }; |
14 | 12 | use crate::{PROGRESS_CHARS, STYLE_BAR_POS}; | |
15 | pub async fn download(config: &Cfg, liststack: Vec<List>, clean: bool, delete_old: bool) -> MLE<()> { | 13 | |
16 | 14 | pub async fn download( | |
15 | config: &Cfg, | ||
16 | liststack: Vec<List>, | ||
17 | clean: bool, | ||
18 | delete_old: bool, | ||
19 | ) -> MLE<()> { | ||
17 | let mp = MultiProgress::new(); | 20 | let mp = MultiProgress::new(); |
18 | let download_p = mp.add(ProgressBar::new(liststack.len().try_into().unwrap())); | 21 | let download_p = mp.add(ProgressBar::new(liststack.len().try_into().unwrap())); |
19 | download_p.set_style(ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS)); | 22 | download_p.set_style( |
23 | ProgressStyle::with_template(STYLE_BAR_POS) | ||
24 | .unwrap() | ||
25 | .progress_chars(PROGRESS_CHARS), | ||
26 | ); | ||
20 | 27 | ||
21 | for current_list in liststack { | 28 | for current_list in liststack { |
22 | download_p.set_message(format!("Download in {}", current_list.id)); | 29 | download_p.set_message(format!("Download in {}", current_list.id)); |
@@ -67,17 +74,27 @@ pub async fn download(config: &Cfg, liststack: Vec<List>, clean: bool, delete_ol | |||
67 | ) | 74 | ) |
68 | .await?; | 75 | .await?; |
69 | } else { | 76 | } else { |
70 | download_p.println(format!("There are no new versions to download for {}", current_list.id)); | 77 | download_p.println(format!( |
78 | "There are no new versions to download for {}", | ||
79 | current_list.id | ||
80 | )); | ||
71 | } | 81 | } |
72 | 82 | ||
73 | if !to_disable.is_empty() { | 83 | if !to_disable.is_empty() { |
74 | let d_p = mp.insert_before(&download_p, ProgressBar::new(to_disable.len().try_into().unwrap())); | 84 | let d_p = mp.insert_before( |
75 | d_p.set_style(ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS)); | 85 | &download_p, |
86 | ProgressBar::new(to_disable.len().try_into().unwrap()), | ||
87 | ); | ||
88 | d_p.set_style( | ||
89 | ProgressStyle::with_template(STYLE_BAR_POS) | ||
90 | .unwrap() | ||
91 | .progress_chars(PROGRESS_CHARS), | ||
92 | ); | ||
76 | for ver in to_disable { | 93 | for ver in to_disable { |
77 | if delete_old { | 94 | if delete_old { |
78 | d_p.set_message(format!("Delete version {}", ver.1)); | 95 | d_p.set_message(format!("Delete version {}", ver.1)); |
79 | d_p.inc(1); | 96 | d_p.inc(1); |
80 | delete_version(current_list.clone(), ver.1)?; | 97 | delete_version(¤t_list, ver.1)?; |
81 | } else { | 98 | } else { |
82 | d_p.set_message(format!("Disable version {}", ver.1)); | 99 | d_p.set_message(format!("Disable version {}", ver.1)); |
83 | d_p.inc(1); | 100 | d_p.inc(1); |
diff --git a/src/commands/io.rs b/src/commands/io.rs index 45e363e..2501583 100644 --- a/src/commands/io.rs +++ b/src/commands/io.rs | |||
@@ -1,12 +1,16 @@ | |||
1 | use indicatif::{ProgressBar, ProgressStyle}; | ||
1 | use serde::{Deserialize, Serialize}; | 2 | use serde::{Deserialize, Serialize}; |
2 | use std::fs::File; | 3 | use std::fs::File; |
3 | use std::io::prelude::*; | 4 | use std::io::prelude::*; |
4 | 5 | ||
5 | use crate::{ | 6 | use crate::{ |
6 | config::Cfg, | 7 | config::Cfg, |
7 | db::{lists_get, lists_get_all_ids, lists_insert, userlist_get_set_version, userlist_get_all_ids, userlist_get_current_version}, | 8 | db::{ |
9 | lists_get, lists_get_all_ids, lists_insert, userlist_get_all_ids, | ||
10 | userlist_get_current_version, userlist_get_set_version, | ||
11 | }, | ||
8 | error::MLE, | 12 | error::MLE, |
9 | mod_add, IDSelector, List, Modloader, AddMod, | 13 | mod_add, AddMod, IDSelector, List, Modloader, STYLE_OPERATION, |
10 | }; | 14 | }; |
11 | 15 | ||
12 | #[derive(Debug, Serialize, Deserialize)] | 16 | #[derive(Debug, Serialize, Deserialize)] |
@@ -17,14 +21,14 @@ struct Export { | |||
17 | #[derive(Debug, Serialize, Deserialize)] | 21 | #[derive(Debug, Serialize, Deserialize)] |
18 | struct ExportVersion { | 22 | struct ExportVersion { |
19 | version: String, | 23 | version: String, |
20 | set: bool | 24 | set: bool, |
21 | } | 25 | } |
22 | 26 | ||
23 | impl ExportVersion { | 27 | impl ExportVersion { |
24 | fn from(config: &Cfg, list_id: &str, mod_id: &str) -> MLE<Self> { | 28 | fn from(config: &Cfg, list_id: &str, mod_id: &str) -> MLE<Self> { |
25 | Ok(Self { | 29 | Ok(Self { |
26 | version: userlist_get_current_version(config, list_id, mod_id)?, | 30 | version: userlist_get_current_version(config, list_id, mod_id)?, |
27 | set: userlist_get_set_version(config, list_id, mod_id)? | 31 | set: userlist_get_set_version(config, list_id, mod_id)?, |
28 | }) | 32 | }) |
29 | } | 33 | } |
30 | } | 34 | } |
@@ -64,23 +68,36 @@ impl ExportList { | |||
64 | } | 68 | } |
65 | 69 | ||
66 | pub fn export(config: &Cfg, list: Option<String>) -> MLE<()> { | 70 | pub fn export(config: &Cfg, list: Option<String>) -> MLE<()> { |
71 | let progress = ProgressBar::new_spinner(); | ||
72 | progress.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | ||
73 | |||
67 | let mut list_ids: Vec<String> = vec![]; | 74 | let mut list_ids: Vec<String> = vec![]; |
68 | if list.is_none() { | 75 | if list.is_none() { |
69 | list_ids = lists_get_all_ids(config)?; | 76 | list_ids = lists_get_all_ids(config)?; |
70 | } else { | 77 | } else { |
71 | list_ids.push(lists_get(config, &list.unwrap())?.id); | 78 | list_ids.push(lists_get(config, &list.unwrap())?.id); |
72 | } | 79 | } |
80 | |||
73 | let mut lists: Vec<ExportList> = vec![]; | 81 | let mut lists: Vec<ExportList> = vec![]; |
74 | for list_id in list_ids { | 82 | for list_id in list_ids { |
83 | progress.set_message(format!("Export {}", list_id)); | ||
84 | //TODO download option/ new download on import | ||
75 | lists.push(ExportList::from(config, &list_id, true)?); | 85 | lists.push(ExportList::from(config, &list_id, true)?); |
76 | } | 86 | } |
77 | 87 | ||
78 | let toml = toml::to_string(&Export { lists })?; | 88 | let toml = toml::to_string(&Export { lists })?; |
79 | 89 | ||
80 | let filestr = dirs::home_dir().unwrap().join("mlexport.toml"); | 90 | let filestr = dirs::home_dir() |
91 | .unwrap() | ||
92 | .join("mlexport.toml") | ||
93 | .into_os_string() | ||
94 | .into_string() | ||
95 | .unwrap(); | ||
81 | 96 | ||
82 | let mut file = File::create(filestr.into_os_string().into_string().unwrap().as_str())?; | 97 | progress.set_message("Create file"); |
98 | let mut file = File::create(&filestr)?; | ||
83 | file.write_all(toml.as_bytes())?; | 99 | file.write_all(toml.as_bytes())?; |
100 | progress.finish_with_message(format!("Exported to {}", filestr)); | ||
84 | 101 | ||
85 | Ok(()) | 102 | Ok(()) |
86 | } | 103 | } |
@@ -108,7 +125,10 @@ pub async fn import(config: &Cfg, file_str: &str, direct_download: bool) -> MLE< | |||
108 | 125 | ||
109 | let mut ver_ids = vec![]; | 126 | let mut ver_ids = vec![]; |
110 | for id in exportlist.versions { | 127 | for id in exportlist.versions { |
111 | ver_ids.push(AddMod { id: IDSelector::VersionID(id.version), set_version: id.set} ); | 128 | ver_ids.push(AddMod { |
129 | id: IDSelector::VersionID(id.version), | ||
130 | set_version: id.set, | ||
131 | }); | ||
112 | } | 132 | } |
113 | mod_add(config, ver_ids, list, direct_download).await?; | 133 | mod_add(config, ver_ids, list, direct_download).await?; |
114 | } | 134 | } |
diff --git a/src/commands/list.rs b/src/commands/list.rs index 52f14f2..b0a082d 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs | |||
@@ -1,11 +1,13 @@ | |||
1 | use indicatif::{ProgressBar, ProgressStyle}; | ||
2 | |||
1 | use crate::{ | 3 | use crate::{ |
2 | config::Cfg, | 4 | config::Cfg, |
3 | db::{ | 5 | db::{ |
4 | config_change_current_list, config_get_current_list, lists_get, lists_insert, lists_remove, | 6 | config_change_current_list, config_get_current_list, lists_get, lists_get_all_ids, |
5 | lists_version, lists_get_all_ids, | 7 | lists_insert, lists_remove, lists_version, |
6 | }, | 8 | }, |
7 | error::{MLE, MLError, ErrorType}, | 9 | error::{ErrorType, MLError, MLE}, |
8 | update, Modloader, | 10 | update, Modloader, STYLE_OPERATION, |
9 | }; | 11 | }; |
10 | 12 | ||
11 | #[derive(Debug, Clone, PartialEq, Eq)] | 13 | #[derive(Debug, Clone, PartialEq, Eq)] |
@@ -28,20 +30,35 @@ pub fn list_add( | |||
28 | modloader: &Modloader, | 30 | modloader: &Modloader, |
29 | directory: &str, | 31 | directory: &str, |
30 | ) -> MLE<()> { | 32 | ) -> MLE<()> { |
31 | lists_insert(config, id, mc_version, modloader, directory) | 33 | let p = ProgressBar::new_spinner(); |
34 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | ||
35 | p.set_message(format!("Create {}", id)); | ||
36 | lists_insert(config, id, mc_version, modloader, directory)?; | ||
37 | p.finish_with_message(format!("Created {}", id)); | ||
38 | Ok(()) | ||
32 | } | 39 | } |
33 | 40 | ||
34 | pub fn list_change(config: &Cfg, id: String) -> MLE<()> { | 41 | pub fn list_change(config: &Cfg, id: &str) -> MLE<()> { |
42 | let p = ProgressBar::new_spinner(); | ||
43 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | ||
44 | p.set_message(format!("Change default list to {}", id)); | ||
45 | |||
35 | if !lists_get_all_ids(config)?.into_iter().any(|l| l == id) { | 46 | if !lists_get_all_ids(config)?.into_iter().any(|l| l == id) { |
36 | return Err(MLError::new(ErrorType::ArgumentError, "List not found")); | 47 | return Err(MLError::new(ErrorType::ArgumentError, "List not found")); |
37 | }; | 48 | }; |
38 | println!("Change default list to: {}", id); | 49 | config_change_current_list(config, id)?; |
39 | config_change_current_list(config, id) | 50 | |
51 | p.finish_with_message(format!("Changed default list to {}", id)); | ||
52 | Ok(()) | ||
40 | } | 53 | } |
41 | 54 | ||
42 | pub fn list_remove(config: &Cfg, id: String) -> MLE<()> { | 55 | pub fn list_remove(config: &Cfg, id: &str) -> MLE<()> { |
43 | //TODO add logging | 56 | let p = ProgressBar::new_spinner(); |
44 | lists_remove(config, id) | 57 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); |
58 | p.set_message(format!("Remove {}", id)); | ||
59 | lists_remove(config, id)?; | ||
60 | p.finish_with_message(format!("Removed {}", id)); | ||
61 | Ok(()) | ||
45 | } | 62 | } |
46 | 63 | ||
47 | ///Changing the current lists version and updating it | 64 | ///Changing the current lists version and updating it |
@@ -57,17 +74,20 @@ pub async fn list_version( | |||
57 | download: bool, | 74 | download: bool, |
58 | delete: bool, | 75 | delete: bool, |
59 | ) -> MLE<()> { | 76 | ) -> MLE<()> { |
60 | println!( | 77 | let p = ProgressBar::new_spinner(); |
78 | p.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | ||
79 | p.set_message(format!( | ||
61 | "Change version for list {} to minecraft version: {}", | 80 | "Change version for list {} to minecraft version: {}", |
62 | id, mc_version | 81 | id, mc_version |
63 | ); | 82 | )); |
64 | 83 | ||
65 | lists_version(config, id, &mc_version)?; | 84 | lists_version(config, id, &mc_version)?; |
66 | 85 | ||
67 | println!( | 86 | p.finish_with_message(format!( |
68 | "\nCheck for updates for new minecraft version in list {}", | 87 | "Changed version for list {} to minecraft version: {}", |
69 | id | 88 | id, mc_version |
70 | ); | 89 | )); |
90 | |||
71 | let list = lists_get(config, id)?; | 91 | let list = lists_get(config, id)?; |
72 | update(config, vec![list], true, download, delete).await | 92 | update(config, vec![list], true, download, delete).await |
73 | } | 93 | } |
diff --git a/src/commands/modification.rs b/src/commands/modification.rs index 8abf913..fdb70c7 100644 --- a/src/commands/modification.rs +++ b/src/commands/modification.rs | |||
@@ -1,23 +1,23 @@ | |||
1 | use std::{io::Write, collections::HashMap}; | 1 | use std::collections::HashMap; |
2 | 2 | ||
3 | use indicatif::{ProgressBar, ProgressStyle, MultiProgress}; | 3 | use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | config::Cfg, | 6 | config::Cfg, |
7 | db::{ | 7 | db::{ |
8 | lists_get_all_ids, mods_get_id, mods_insert, mods_remove, userlist_get_all_ids, | 8 | lists_get_all_ids, mods_get_id, mods_get_info, mods_insert, mods_remove, |
9 | userlist_get_current_version, userlist_insert, userlist_remove, mods_get_info, | 9 | userlist_get_all_ids, userlist_get_current_version, userlist_insert, userlist_remove, |
10 | }, | 10 | }, |
11 | error::{ErrorType, MLError, MLE}, | 11 | error::{ErrorType, MLError, MLE}, |
12 | files::{delete_version, download_versions}, | 12 | files::{delete_version, download_versions}, |
13 | modrinth::{extract_current_version, get_raw_versions, project, projects, versions, Version}, | 13 | modrinth::{extract_current_version, get_raw_versions, project, projects, versions, Version}, |
14 | List, PROGRESS_CHARS, STYLE_BAR_POS, | 14 | List, PROGRESS_CHARS, STYLE_BAR_POS, STYLE_OPERATION, |
15 | }; | 15 | }; |
16 | 16 | ||
17 | #[derive(Debug)] | 17 | #[derive(Debug)] |
18 | pub struct AddMod { | 18 | pub struct AddMod { |
19 | pub id: IDSelector, | 19 | pub id: IDSelector, |
20 | pub set_version: bool | 20 | pub set_version: bool, |
21 | } | 21 | } |
22 | 22 | ||
23 | #[derive(Debug, PartialEq, Eq)] | 23 | #[derive(Debug, PartialEq, Eq)] |
@@ -47,9 +47,13 @@ pub async fn mod_add( | |||
47 | 47 | ||
48 | let mut mod_ids: Vec<(String, bool)> = Vec::new(); | 48 | let mut mod_ids: Vec<(String, bool)> = Vec::new(); |
49 | let mut ver_ids: Vec<(String, bool)> = Vec::new(); | 49 | let mut ver_ids: Vec<(String, bool)> = Vec::new(); |
50 | 50 | ||
51 | let add_p = mp.add(ProgressBar::new(mods.len().try_into().unwrap())); | 51 | let add_p = mp.add(ProgressBar::new(mods.len().try_into().unwrap())); |
52 | add_p.set_style(ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS)); | 52 | add_p.set_style( |
53 | ProgressStyle::with_template(STYLE_BAR_POS) | ||
54 | .unwrap() | ||
55 | .progress_chars(PROGRESS_CHARS), | ||
56 | ); | ||
53 | add_p.set_message("Sort ids"); | 57 | add_p.set_message("Sort ids"); |
54 | 58 | ||
55 | //"Sort" project ids from version ids to be able to handle them differently but in a batch | 59 | //"Sort" project ids from version ids to be able to handle them differently but in a batch |
@@ -62,7 +66,7 @@ pub async fn mod_add( | |||
62 | } | 66 | } |
63 | 67 | ||
64 | add_p.set_message("Get infos"); | 68 | add_p.set_message("Get infos"); |
65 | 69 | ||
66 | let mut projectinfo: Vec<ProjectInfo> = Vec::new(); | 70 | let mut projectinfo: Vec<ProjectInfo> = Vec::new(); |
67 | if !mod_ids.is_empty() { | 71 | if !mod_ids.is_empty() { |
68 | projectinfo.append(&mut get_mod_infos(config, mod_ids, list.clone()).await?); | 72 | projectinfo.append(&mut get_mod_infos(config, mod_ids, list.clone()).await?); |
@@ -80,11 +84,17 @@ pub async fn mod_add( | |||
80 | let mut downloadstack: Vec<Version> = Vec::new(); | 84 | let mut downloadstack: Vec<Version> = Vec::new(); |
81 | 85 | ||
82 | //Adding each mod to the lists and downloadstack | 86 | //Adding each mod to the lists and downloadstack |
83 | let project_p = mp.insert_before(&add_p, ProgressBar::new(projectinfo.len().try_into().unwrap())); | 87 | let project_p = mp.insert_before( |
84 | project_p.set_style(ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS)); | 88 | &add_p, |
89 | ProgressBar::new(projectinfo.len().try_into().unwrap()), | ||
90 | ); | ||
91 | project_p.set_style( | ||
92 | ProgressStyle::with_template(STYLE_BAR_POS) | ||
93 | .unwrap() | ||
94 | .progress_chars(PROGRESS_CHARS), | ||
95 | ); | ||
85 | 96 | ||
86 | for project in projectinfo { | 97 | for project in projectinfo { |
87 | |||
88 | project_p.set_message(format!("Add {}", project.title)); | 98 | project_p.set_message(format!("Add {}", project.title)); |
89 | 99 | ||
90 | let current_version_id = if project.current_version.is_none() { | 100 | let current_version_id = if project.current_version.is_none() { |
@@ -116,12 +126,7 @@ pub async fn mod_add( | |||
116 | Ok(..) => Ok(..), | 126 | Ok(..) => Ok(..), |
117 | }?; | 127 | }?; |
118 | 128 | ||
119 | match mods_insert( | 129 | match mods_insert(config, &project.mod_id, &project.slug, &project.title) { |
120 | config, | ||
121 | &project.mod_id, | ||
122 | &project.slug, | ||
123 | &project.title, | ||
124 | ) { | ||
125 | Err(e) => { | 130 | Err(e) => { |
126 | if e.to_string() == "SQL: UNIQUE constraint failed: mods.id" { | 131 | if e.to_string() == "SQL: UNIQUE constraint failed: mods.id" { |
127 | Ok(..) | 132 | Ok(..) |
@@ -152,8 +157,11 @@ pub async fn mod_add( | |||
152 | Ok(()) | 157 | Ok(()) |
153 | } | 158 | } |
154 | 159 | ||
155 | async fn get_mod_infos(config: &Cfg, mod_ids: Vec<(String, bool)>, list: List) -> MLE<Vec<ProjectInfo>> { | 160 | async fn get_mod_infos( |
156 | 161 | config: &Cfg, | |
162 | mod_ids: Vec<(String, bool)>, | ||
163 | list: List, | ||
164 | ) -> MLE<Vec<ProjectInfo>> { | ||
157 | let mut setmap: HashMap<String, bool> = HashMap::new(); | 165 | let mut setmap: HashMap<String, bool> = HashMap::new(); |
158 | 166 | ||
159 | let mut ids = vec![]; | 167 | let mut ids = vec![]; |
@@ -197,19 +205,15 @@ async fn get_mod_infos(config: &Cfg, mod_ids: Vec<(String, bool)>, list: List) - | |||
197 | .find(|v| v.id == current_id) | 205 | .find(|v| v.id == current_id) |
198 | .unwrap(), | 206 | .unwrap(), |
199 | ); | 207 | ); |
200 | 208 | ||
201 | // match primary, if none? | 209 | // match primary, if none? |
202 | let files = current_version | 210 | let files = current_version.clone().ok_or("").unwrap().files; |
203 | .clone() | ||
204 | .ok_or("") | ||
205 | .unwrap() | ||
206 | .files; | ||
207 | 211 | ||
208 | file = match files.clone().into_iter().find(|f| f.primary) { | 212 | file = match files.clone().into_iter().find(|f| f.primary) { |
209 | Some(f) => f, | 213 | Some(f) => f, |
210 | None => { files[0].clone() } | 214 | None => files[0].clone(), |
211 | } | 215 | } |
212 | .url; | 216 | .url; |
213 | 217 | ||
214 | for ver in available_versions { | 218 | for ver in available_versions { |
215 | available_versions_vec.push(ver.id); | 219 | available_versions_vec.push(ver.id); |
@@ -247,7 +251,6 @@ async fn get_mod_infos(config: &Cfg, mod_ids: Vec<(String, bool)>, list: List) - | |||
247 | } | 251 | } |
248 | 252 | ||
249 | async fn get_ver_info(config: &Cfg, ver_ids: Vec<(String, bool)>) -> MLE<Vec<ProjectInfo>> { | 253 | async fn get_ver_info(config: &Cfg, ver_ids: Vec<(String, bool)>) -> MLE<Vec<ProjectInfo>> { |
250 | |||
251 | let mut setmap: HashMap<String, bool> = HashMap::new(); | 254 | let mut setmap: HashMap<String, bool> = HashMap::new(); |
252 | 255 | ||
253 | let mut ids = vec![]; | 256 | let mut ids = vec![]; |
@@ -271,15 +274,13 @@ async fn get_ver_info(config: &Cfg, ver_ids: Vec<(String, bool)>) -> MLE<Vec<Pro | |||
271 | for (i, project) in v_projects.into_iter().enumerate() { | 274 | for (i, project) in v_projects.into_iter().enumerate() { |
272 | let version = &v_versions[i]; | 275 | let version = &v_versions[i]; |
273 | 276 | ||
274 | let files = version | 277 | let files = version.clone().files; |
275 | .clone() | ||
276 | .files; | ||
277 | 278 | ||
278 | let file = match files.clone().into_iter().find(|f| f.primary) { | 279 | let file = match files.clone().into_iter().find(|f| f.primary) { |
279 | Some(f) => f, | 280 | Some(f) => f, |
280 | None => { files[0].clone() } | 281 | None => files[0].clone(), |
281 | } | 282 | } |
282 | .url; | 283 | .url; |
283 | 284 | ||
284 | projectinfo.push(ProjectInfo { | 285 | projectinfo.push(ProjectInfo { |
285 | mod_id: String::from(&project.id), | 286 | mod_id: String::from(&project.id), |
@@ -300,34 +301,31 @@ async fn get_ver_info(config: &Cfg, ver_ids: Vec<(String, bool)>) -> MLE<Vec<Pro | |||
300 | /// * `config` - config struct | 301 | /// * `config` - config struct |
301 | /// * `id` - name, slug or id of the mod | 302 | /// * `id` - name, slug or id of the mod |
302 | /// * `list` - List struct | 303 | /// * `list` - List struct |
303 | pub fn mod_remove(config: &Cfg, id: &str, list: List) -> MLE<()> { | 304 | pub fn mod_remove(config: &Cfg, id: &str, list: &List) -> MLE<()> { |
305 | let progress = ProgressBar::new_spinner(); | ||
306 | progress.set_style(ProgressStyle::with_template(STYLE_OPERATION).unwrap()); | ||
307 | |||
304 | let mod_id = mods_get_id(&config.data, id)?; | 308 | let mod_id = mods_get_id(&config.data, id)?; |
305 | 309 | ||
306 | println!("Remove mod {} from {}", mods_get_info(config, &mod_id)?.title, list.id); | 310 | let info = mods_get_info(config, &mod_id)?; |
311 | |||
312 | progress.set_message(format!("Remove {} from {}", info.title, list.id)); | ||
313 | |||
307 | let version = userlist_get_current_version(config, &list.id, &mod_id)?; | 314 | let version = userlist_get_current_version(config, &list.id, &mod_id)?; |
308 | 315 | ||
309 | print!(" â””Remove from list"); | ||
310 | //Force flush of stdout, else print! doesn't print instantly | ||
311 | std::io::stdout().flush()?; | ||
312 | userlist_remove(config, &list.id, &mod_id)?; | 316 | userlist_remove(config, &list.id, &mod_id)?; |
313 | println!(" ✓"); | ||
314 | 317 | ||
315 | print!(" â””Delete file"); | 318 | progress.set_message("Delete file"); |
316 | //Force flush of stdout, else print! doesn't print instantly | ||
317 | std::io::stdout().flush()?; | ||
318 | match delete_version(list, version) { | 319 | match delete_version(list, version) { |
319 | Ok(_) => (), | 320 | Ok(_) => (), |
320 | Err(err) => { | 321 | Err(err) => { |
321 | if err.to_string() != "User input not accepted: VERSION_NOT_FOUND_IN_FILES" { | 322 | if err.to_string() != "User input not accepted: VERSION_NOT_FOUND_IN_FILES" { |
322 | return Err(err); | 323 | return Err(err); |
323 | }; | 324 | }; |
324 | }, | 325 | } |
325 | }; | 326 | }; |
326 | println!(" ✓"); | ||
327 | 327 | ||
328 | print!(" â””Clean main db table"); | 328 | progress.set_message("Check main list"); |
329 | //Force flush of stdout, else print! doesn't print instantly | ||
330 | std::io::stdout().flush()?; | ||
331 | let list_ids = lists_get_all_ids(config)?; | 329 | let list_ids = lists_get_all_ids(config)?; |
332 | 330 | ||
333 | // Remove mod from main list if not used elsewhere | 331 | // Remove mod from main list if not used elsewhere |
@@ -336,11 +334,11 @@ pub fn mod_remove(config: &Cfg, id: &str, list: List) -> MLE<()> { | |||
336 | let mods = match userlist_get_all_ids(config, &id) { | 334 | let mods = match userlist_get_all_ids(config, &id) { |
337 | Ok(m) => m, | 335 | Ok(m) => m, |
338 | Err(err) => { | 336 | Err(err) => { |
339 | if err.to_string() == "Database: NO_MODS_USERLIST" { | 337 | if err.to_string() == "Database: NO_MODS_USERLIST" { |
340 | println!(" ✓"); | 338 | println!(" ✓"); |
341 | return Ok(()); | 339 | return Ok(()); |
342 | }; | 340 | }; |
343 | return Err(err) | 341 | return Err(err); |
344 | } | 342 | } |
345 | }; | 343 | }; |
346 | if mods.contains(&mod_id) { | 344 | if mods.contains(&mod_id) { |
@@ -350,9 +348,11 @@ pub fn mod_remove(config: &Cfg, id: &str, list: List) -> MLE<()> { | |||
350 | } | 348 | } |
351 | 349 | ||
352 | if !mod_used { | 350 | if !mod_used { |
353 | mods_remove(config, mod_id)?; | 351 | progress.set_message("Remove from main list"); |
352 | mods_remove(config, &mod_id)?; | ||
354 | }; | 353 | }; |
355 | println!(" ✓"); | 354 | |
355 | progress.finish_with_message(format!("Removed {} from {}", info.title, list.id)); | ||
356 | 356 | ||
357 | Ok(()) | 357 | Ok(()) |
358 | } | 358 | } |
diff --git a/src/commands/update.rs b/src/commands/update.rs index 194bbe5..3aae002 100644 --- a/src/commands/update.rs +++ b/src/commands/update.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use indicatif::{ProgressBar, ProgressStyle, MultiProgress}; | 1 | use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; |
2 | 2 | ||
3 | use crate::{ | 3 | use crate::{ |
4 | config::Cfg, | 4 | config::Cfg, |
@@ -19,11 +19,14 @@ pub async fn update( | |||
19 | direct_download: bool, | 19 | direct_download: bool, |
20 | delete_old: bool, | 20 | delete_old: bool, |
21 | ) -> MLE<()> { | 21 | ) -> MLE<()> { |
22 | |||
23 | let mp = MultiProgress::new(); | 22 | let mp = MultiProgress::new(); |
24 | 23 | ||
25 | let update_p = mp.add(ProgressBar::new(liststack.len().try_into().unwrap())); | 24 | let update_p = mp.add(ProgressBar::new(liststack.len().try_into().unwrap())); |
26 | update_p.set_style(ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS)); | 25 | update_p.set_style( |
26 | ProgressStyle::with_template(STYLE_BAR_POS) | ||
27 | .unwrap() | ||
28 | .progress_chars(PROGRESS_CHARS), | ||
29 | ); | ||
27 | 30 | ||
28 | for current_list in liststack { | 31 | for current_list in liststack { |
29 | update_p.set_message(format!("Update {}", current_list.id)); | 32 | update_p.set_message(format!("Update {}", current_list.id)); |
@@ -35,7 +38,11 @@ pub async fn update( | |||
35 | let mods = userlist_get_all_ids(config, ¤t_list.id)?; | 38 | let mods = userlist_get_all_ids(config, ¤t_list.id)?; |
36 | 39 | ||
37 | let list_u_p = mp.insert_before(&list_p, ProgressBar::new(mods.len().try_into().unwrap())); | 40 | let list_u_p = mp.insert_before(&list_p, ProgressBar::new(mods.len().try_into().unwrap())); |
38 | list_u_p.set_style(ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS)); | 41 | list_u_p.set_style( |
42 | ProgressStyle::with_template(STYLE_BAR_POS) | ||
43 | .unwrap() | ||
44 | .progress_chars(PROGRESS_CHARS), | ||
45 | ); | ||
39 | 46 | ||
40 | let mut current_versions: Vec<(String, String)> = vec![]; | 47 | let mut current_versions: Vec<(String, String)> = vec![]; |
41 | let mut updatestack: Vec<Version> = vec![]; | 48 | let mut updatestack: Vec<Version> = vec![]; |
@@ -43,7 +50,7 @@ pub async fn update( | |||
43 | for id in mods { | 50 | for id in mods { |
44 | let info = mods_get_info(config, &id)?; | 51 | let info = mods_get_info(config, &id)?; |
45 | list_u_p.set_message(format!("Update {}", info.title)); | 52 | list_u_p.set_message(format!("Update {}", info.title)); |
46 | 53 | ||
47 | //Skip check if version is set | 54 | //Skip check if version is set |
48 | if userlist_get_set_version(config, ¤t_list.id, &id)? { | 55 | if userlist_get_set_version(config, ¤t_list.id, &id)? { |
49 | list_u_p.inc(1); | 56 | list_u_p.inc(1); |
@@ -51,19 +58,10 @@ pub async fn update( | |||
51 | } | 58 | } |
52 | 59 | ||
53 | //Getting current installed version for disable or delete | 60 | //Getting current installed version for disable or delete |
54 | let disable_version = | 61 | let disable_version = userlist_get_current_version(config, ¤t_list.id, &id)?; |
55 | userlist_get_current_version(config, ¤t_list.id, &id)?; | ||
56 | 62 | ||
57 | updatestack.push( | 63 | updatestack.push( |
58 | match specific_update( | 64 | match specific_update(config, clean, current_list.clone(), &id, &list_u_p).await { |
59 | config, | ||
60 | clean, | ||
61 | current_list.clone(), | ||
62 | &id, | ||
63 | &list_u_p | ||
64 | ) | ||
65 | .await | ||
66 | { | ||
67 | Ok(ver) => { | 65 | Ok(ver) => { |
68 | current_versions.push((disable_version, id)); | 66 | current_versions.push((disable_version, id)); |
69 | ver | 67 | ver |
@@ -89,17 +87,31 @@ pub async fn update( | |||
89 | }; | 87 | }; |
90 | 88 | ||
91 | if direct_download && !updatestack.is_empty() { | 89 | if direct_download && !updatestack.is_empty() { |
92 | download_versions(current_list.clone(), config.clone(), updatestack, &mp, &list_p).await?; | 90 | download_versions( |
91 | current_list.clone(), | ||
92 | config.clone(), | ||
93 | updatestack, | ||
94 | &mp, | ||
95 | &list_p, | ||
96 | ) | ||
97 | .await?; | ||
93 | 98 | ||
94 | //Disable old versions | 99 | //Disable old versions |
95 | if !clean { | 100 | if !clean { |
96 | let d_p = mp.insert_before(&list_p, ProgressBar::new(current_versions.len().try_into().unwrap())); | 101 | let d_p = mp.insert_before( |
97 | d_p.set_style(ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS)); | 102 | &list_p, |
103 | ProgressBar::new(current_versions.len().try_into().unwrap()), | ||
104 | ); | ||
105 | d_p.set_style( | ||
106 | ProgressStyle::with_template(STYLE_BAR_POS) | ||
107 | .unwrap() | ||
108 | .progress_chars(PROGRESS_CHARS), | ||
109 | ); | ||
98 | for ver in current_versions { | 110 | for ver in current_versions { |
99 | if delete_old { | 111 | if delete_old { |
100 | d_p.set_message(format!("Delete version {}", ver.0)); | 112 | d_p.set_message(format!("Delete version {}", ver.0)); |
101 | d_p.inc(1); | 113 | d_p.inc(1); |
102 | delete_version(current_list.clone(), ver.0)?; | 114 | delete_version(¤t_list, ver.0)?; |
103 | } else if ver.0 != "NONE" { | 115 | } else if ver.0 != "NONE" { |
104 | d_p.set_message(format!("Disable version {}", ver.0)); | 116 | d_p.set_message(format!("Disable version {}", ver.0)); |
105 | d_p.inc(1); | 117 | d_p.inc(1); |
@@ -125,9 +137,14 @@ pub async fn update( | |||
125 | Ok(()) | 137 | Ok(()) |
126 | } | 138 | } |
127 | 139 | ||
128 | async fn specific_update(config: &Cfg, clean: bool, list: List, id: &str, progress: &ProgressBar) -> MLE<Version> { | 140 | async fn specific_update( |
129 | let applicable_versions = | 141 | config: &Cfg, |
130 | versions(&config.apis.modrinth, String::from(id), list.clone()).await; | 142 | clean: bool, |
143 | list: List, | ||
144 | id: &str, | ||
145 | progress: &ProgressBar, | ||
146 | ) -> MLE<Version> { | ||
147 | let applicable_versions = versions(&config.apis.modrinth, String::from(id), list.clone()).await; | ||
131 | 148 | ||
132 | let mut versions: Vec<String> = vec![]; | 149 | let mut versions: Vec<String> = vec![]; |
133 | 150 | ||
@@ -142,15 +159,16 @@ async fn specific_update(config: &Cfg, clean: bool, list: List, id: &str, progre | |||
142 | let mut current: Vec<Version> = vec![]; | 159 | let mut current: Vec<Version> = vec![]; |
143 | if clean | 160 | if clean |
144 | || (versions.join("|") | 161 | || (versions.join("|") |
145 | != userlist_get_applicable_versions( | 162 | != userlist_get_applicable_versions(config, String::from(&list.id), String::from(id))?) |
146 | config, | ||
147 | String::from(&list.id), | ||
148 | String::from(id), | ||
149 | )?) | ||
150 | { | 163 | { |
151 | let current_str = extract_current_version(applicable_versions.clone())?; | 164 | let current_str = extract_current_version(applicable_versions.clone())?; |
152 | 165 | ||
153 | if !clean { progress.println(format!("Found new version for {}", mods_get_info(config, id).unwrap().title)); } | 166 | if !clean { |
167 | progress.println(format!( | ||
168 | "Found new version for {}", | ||
169 | mods_get_info(config, id).unwrap().title | ||
170 | )); | ||
171 | } | ||
154 | 172 | ||
155 | //get new versions | 173 | //get new versions |
156 | let current_ver = match applicable_versions | 174 | let current_ver = match applicable_versions |
@@ -166,12 +184,19 @@ async fn specific_update(config: &Cfg, clean: bool, list: List, id: &str, progre | |||
166 | let files = ¤t_ver.files; | 184 | let files = ¤t_ver.files; |
167 | 185 | ||
168 | let link = match files.clone().into_iter().find(|f| f.primary) { | 186 | let link = match files.clone().into_iter().find(|f| f.primary) { |
169 | Some(f) => f, | 187 | Some(f) => f, |
170 | None => { files[0].clone() } | 188 | None => files[0].clone(), |
171 | } | 189 | } |
172 | .url; | 190 | .url; |
173 | 191 | ||
174 | userlist_change_versions(config, list.id, current_str, versions.join("|"), link, id.to_string())?; | 192 | userlist_change_versions( |
193 | config, | ||
194 | list.id, | ||
195 | current_str, | ||
196 | versions.join("|"), | ||
197 | link, | ||
198 | id.to_string(), | ||
199 | )?; | ||
175 | } | 200 | } |
176 | 201 | ||
177 | if current.is_empty() { | 202 | if current.is_empty() { |
diff --git a/src/config.rs b/src/config.rs index 54cf768..3858484 100644 --- a/src/config.rs +++ b/src/config.rs | |||
@@ -7,7 +7,7 @@ use std::{ | |||
7 | use indicatif::{ProgressBar, ProgressStyle}; | 7 | use indicatif::{ProgressBar, ProgressStyle}; |
8 | use serde::{Deserialize, Serialize}; | 8 | use serde::{Deserialize, Serialize}; |
9 | 9 | ||
10 | use crate::{db::db_setup, error::MLE, Modloader, VersionLevel, check_game_versions}; | 10 | use crate::{check_game_versions, db::db_setup, error::MLE, Modloader, VersionLevel}; |
11 | 11 | ||
12 | #[derive(Debug, Clone, Serialize, Deserialize)] | 12 | #[derive(Debug, Clone, Serialize, Deserialize)] |
13 | pub struct Cfg { | 13 | pub struct Cfg { |
@@ -72,7 +72,7 @@ impl Cfg { | |||
72 | Err(..) => { | 72 | Err(..) => { |
73 | create_versions_dummy(&versionfile).await?; | 73 | create_versions_dummy(&versionfile).await?; |
74 | check_game_versions(&versionfile, true).await?; | 74 | check_game_versions(&versionfile, true).await?; |
75 | }, | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | Ok(config) | 78 | Ok(config) |
@@ -95,7 +95,7 @@ fn create_config(path: &str) -> MLE<()> { | |||
95 | versions: cache_dir, | 95 | versions: cache_dir, |
96 | defaults: Defaults { | 96 | defaults: Defaults { |
97 | modloader: Modloader::Fabric, | 97 | modloader: Modloader::Fabric, |
98 | version: VersionLevel::Release | 98 | version: VersionLevel::Release, |
99 | }, | 99 | }, |
100 | apis: Apis { | 100 | apis: Apis { |
101 | modrinth: String::from("https://api.modrinth.com/v2/"), | 101 | modrinth: String::from("https://api.modrinth.com/v2/"), |
@@ -120,9 +120,7 @@ pub fn mods_get_info(config: &Cfg, id: &str) -> MLE<ModInfo> { | |||
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | pub fn mods_remove(config: &Cfg, id: String) -> MLE<()> { | 123 | pub fn mods_remove(config: &Cfg, id: &str) -> MLE<()> { |
124 | // println!("Removing mod {} from database", id); | ||
125 | |||
126 | let data = format!("{}/data.db", config.data); | 124 | let data = format!("{}/data.db", config.data); |
127 | let connection = Connection::open(data)?; | 125 | let connection = Connection::open(data)?; |
128 | 126 | ||
@@ -233,7 +231,10 @@ pub fn userlist_get_all_ids(config: &Cfg, list_id: &str) -> MLE<Vec<String>> { | |||
233 | } | 231 | } |
234 | 232 | ||
235 | match mod_ids.is_empty() { | 233 | match mod_ids.is_empty() { |
236 | true => Err(MLError::new(ErrorType::DBError, &format!("NO_MODS_USERLIST{}", list_id))), | 234 | true => Err(MLError::new( |
235 | ErrorType::DBError, | ||
236 | &format!("NO_MODS_USERLIST{}", list_id), | ||
237 | )), | ||
237 | false => Ok(mod_ids), | 238 | false => Ok(mod_ids), |
238 | } | 239 | } |
239 | } | 240 | } |
@@ -325,10 +326,7 @@ pub fn userlist_get_current_version(config: &Cfg, list_id: &str, mod_id: &str) - | |||
325 | } | 326 | } |
326 | } | 327 | } |
327 | 328 | ||
328 | pub fn userlist_get_all_current_version_ids( | 329 | pub fn userlist_get_all_current_version_ids(config: &Cfg, list_id: String) -> MLE<Vec<String>> { |
329 | config: &Cfg, | ||
330 | list_id: String, | ||
331 | ) -> MLE<Vec<String>> { | ||
332 | let data = format!("{}/data.db", config.data); | 330 | let data = format!("{}/data.db", config.data); |
333 | let connection = Connection::open(data)?; | 331 | let connection = Connection::open(data)?; |
334 | 332 | ||
@@ -342,10 +340,7 @@ pub fn userlist_get_all_current_version_ids( | |||
342 | } | 340 | } |
343 | 341 | ||
344 | if versions.is_empty() { | 342 | if versions.is_empty() { |
345 | return Err(MLError::new( | 343 | return Err(MLError::new(ErrorType::DBError, "NO_MODS_ON_LIST")); |
346 | ErrorType::DBError, | ||
347 | "NO_MODS_ON_LIST", | ||
348 | )); | ||
349 | }; | 344 | }; |
350 | 345 | ||
351 | Ok(versions) | 346 | Ok(versions) |
@@ -441,7 +436,11 @@ pub fn userlist_add_disabled_versions( | |||
441 | Ok(()) | 436 | Ok(()) |
442 | } | 437 | } |
443 | 438 | ||
444 | pub fn userlist_get_disabled_versions(config: &Cfg, list_id: String, mod_id: String) -> MLE<String> { | 439 | pub fn userlist_get_disabled_versions( |
440 | config: &Cfg, | ||
441 | list_id: String, | ||
442 | mod_id: String, | ||
443 | ) -> MLE<String> { | ||
445 | let data = format!("{}/data.db", config.data); | 444 | let data = format!("{}/data.db", config.data); |
446 | let connection = Connection::open(data).unwrap(); | 445 | let connection = Connection::open(data).unwrap(); |
447 | 446 | ||
@@ -504,19 +503,14 @@ pub fn lists_insert( | |||
504 | 503 | ||
505 | connection.execute( | 504 | connection.execute( |
506 | "INSERT INTO lists VALUES (?1, ?2, ?3, ?4)", | 505 | "INSERT INTO lists VALUES (?1, ?2, ?3, ?4)", |
507 | [ | 506 | [id, mc_version, &mod_loader.to_string(), download_folder], |
508 | id, | ||
509 | mc_version, | ||
510 | &mod_loader.to_string(), | ||
511 | download_folder, | ||
512 | ], | ||
513 | )?; | 507 | )?; |
514 | connection.execute(format!("CREATE TABLE {}( 'mod_id' TEXT, 'current_version' TEXT, 'applicable_versions' BLOB, 'current_download' TEXT, 'disabled_versions' TEXT DEFAULT 'NONE', 'set_version' INTEGER, CONSTRAINT {}_PK PRIMARY KEY (mod_id) )", id, id).as_str(), [])?; | 508 | connection.execute(format!("CREATE TABLE {}( 'mod_id' TEXT, 'current_version' TEXT, 'applicable_versions' BLOB, 'current_download' TEXT, 'disabled_versions' TEXT DEFAULT 'NONE', 'set_version' INTEGER, CONSTRAINT {}_PK PRIMARY KEY (mod_id) )", id, id).as_str(), [])?; |
515 | 509 | ||
516 | Ok(()) | 510 | Ok(()) |
517 | } | 511 | } |
518 | 512 | ||
519 | pub fn lists_remove(config: &Cfg, id: String) -> MLE<()> { | 513 | pub fn lists_remove(config: &Cfg, id: &str) -> MLE<()> { |
520 | let data = format!("{}/data.db", config.data); | 514 | let data = format!("{}/data.db", config.data); |
521 | let connection = Connection::open(data)?; | 515 | let connection = Connection::open(data)?; |
522 | 516 | ||
@@ -593,7 +587,7 @@ pub fn lists_get_all_ids(config: &Cfg) -> MLE<Vec<String>> { | |||
593 | } | 587 | } |
594 | 588 | ||
595 | //config | 589 | //config |
596 | pub fn config_change_current_list(config: &Cfg, id: String) -> MLE<()> { | 590 | pub fn config_change_current_list(config: &Cfg, id: &str) -> MLE<()> { |
597 | let data = format!("{}/data.db", config.data); | 591 | let data = format!("{}/data.db", config.data); |
598 | let connection = Connection::open(data)?; | 592 | let connection = Connection::open(data)?; |
599 | 593 | ||
@@ -655,7 +649,10 @@ pub fn s_config_create_version(config: &Cfg) -> Result<(), Box<dyn std::error::E | |||
655 | Ok(()) | 649 | Ok(()) |
656 | } | 650 | } |
657 | 651 | ||
658 | pub fn s_config_update_version(config: &Cfg, ver: String) -> Result<(), Box<dyn std::error::Error>> { | 652 | pub fn s_config_update_version( |
653 | config: &Cfg, | ||
654 | ver: String, | ||
655 | ) -> Result<(), Box<dyn std::error::Error>> { | ||
659 | let data = format!("{}/data.db", config.data); | 656 | let data = format!("{}/data.db", config.data); |
660 | let connection = Connection::open(data)?; | 657 | let connection = Connection::open(data)?; |
661 | 658 | ||
diff --git a/src/error.rs b/src/error.rs index e6afeaa..f981f14 100644 --- a/src/error.rs +++ b/src/error.rs | |||
@@ -106,9 +106,11 @@ impl From<std::io::Error> for MLError { | |||
106 | 106 | ||
107 | impl From<serde_json::error::Error> for MLError { | 107 | impl From<serde_json::error::Error> for MLError { |
108 | fn from(value: serde_json::error::Error) -> Self { | 108 | fn from(value: serde_json::error::Error) -> Self { |
109 | Self { etype: ErrorType::LibJson, message: value.to_string() } | 109 | Self { |
110 | etype: ErrorType::LibJson, | ||
111 | message: value.to_string(), | ||
112 | } | ||
110 | } | 113 | } |
111 | |||
112 | } | 114 | } |
113 | 115 | ||
114 | impl MLError { | 116 | impl MLError { |
diff --git a/src/files.rs b/src/files.rs index 814f06d..e874d9d 100644 --- a/src/files.rs +++ b/src/files.rs | |||
@@ -1,12 +1,13 @@ | |||
1 | use futures_util::StreamExt; | 1 | use futures_util::StreamExt; |
2 | use indicatif::{ProgressBar, ProgressStyle, MultiProgress}; | 2 | use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; |
3 | use reqwest::Client; | 3 | use reqwest::Client; |
4 | use tokio::task::JoinSet; | ||
5 | use std::{ | 4 | use std::{ |
5 | cmp::min, | ||
6 | collections::HashMap, | 6 | collections::HashMap, |
7 | fs::{copy, read_dir, remove_file, rename, File}, | 7 | fs::{copy, read_dir, remove_file, rename, File}, |
8 | io::Write, cmp::min, | 8 | io::Write, |
9 | }; | 9 | }; |
10 | use tokio::task::JoinSet; | ||
10 | 11 | ||
11 | use crate::{ | 12 | use crate::{ |
12 | cache::{copy_cached_version, get_cached_versions}, | 13 | cache::{copy_cached_version, get_cached_versions}, |
@@ -14,34 +15,61 @@ use crate::{ | |||
14 | db::{mods_get_info, userlist_add_disabled_versions}, | 15 | db::{mods_get_info, userlist_add_disabled_versions}, |
15 | error::{ErrorType, MLError, MLE}, | 16 | error::{ErrorType, MLError, MLE}, |
16 | modrinth::Version, | 17 | modrinth::Version, |
17 | List, PROGRESS_CHARS, STYLE_SPINNER, STYLE_BAR_BYTE, STYLE_BAR_POS, | 18 | List, PROGRESS_CHARS, STYLE_BAR_BYTE, STYLE_BAR_POS, STYLE_SPINNER, |
18 | }; | 19 | }; |
19 | 20 | ||
20 | pub async fn download_versions(list: List, config: Cfg, versions: Vec<Version>, progress: &MultiProgress, progress_before: &ProgressBar) -> MLE<()> { | 21 | pub async fn download_versions( |
22 | list: List, | ||
23 | config: Cfg, | ||
24 | versions: Vec<Version>, | ||
25 | progress: &MultiProgress, | ||
26 | progress_before: &ProgressBar, | ||
27 | ) -> MLE<()> { | ||
21 | let cached = get_cached_versions(&config.cache); | 28 | let cached = get_cached_versions(&config.cache); |
22 | 29 | ||
23 | let mut js = JoinSet::new(); | 30 | let mut js = JoinSet::new(); |
24 | 31 | ||
25 | let style_spinner = ProgressStyle::with_template(STYLE_SPINNER).unwrap(); | 32 | let style_spinner = ProgressStyle::with_template(STYLE_SPINNER).unwrap(); |
26 | 33 | ||
27 | let all = progress.insert_before(progress_before, ProgressBar::new(versions.len().try_into().unwrap())); | 34 | let all = progress.insert_before( |
28 | all.set_style(ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS)); | 35 | progress_before, |
36 | ProgressBar::new(versions.len().try_into().unwrap()), | ||
37 | ); | ||
38 | all.set_style( | ||
39 | ProgressStyle::with_template(STYLE_BAR_POS) | ||
40 | .unwrap() | ||
41 | .progress_chars(PROGRESS_CHARS), | ||
42 | ); | ||
29 | all.set_message(format!("✓Downloading {}", list.id)); | 43 | all.set_message(format!("✓Downloading {}", list.id)); |
30 | 44 | ||
31 | for ver in versions { | 45 | for ver in versions { |
32 | let p = progress.insert_before(&all, ProgressBar::new(1)); | 46 | let p = progress.insert_before(&all, ProgressBar::new(1)); |
33 | p.set_style(style_spinner.clone()); | 47 | p.set_style(style_spinner.clone()); |
34 | js.spawn(download_version(config.clone(), list.clone(), ver, cached.clone(), p)); | 48 | js.spawn(download_version( |
49 | config.clone(), | ||
50 | list.clone(), | ||
51 | ver, | ||
52 | cached.clone(), | ||
53 | p, | ||
54 | )); | ||
55 | } | ||
56 | |||
57 | while js.join_next().await.is_some() { | ||
58 | all.inc(1) | ||
35 | } | 59 | } |
36 | 60 | ||
37 | while js.join_next().await.is_some() { all.inc(1) } | ||
38 | |||
39 | all.finish_with_message(format!("✓Downloading {}", list.id)); | 61 | all.finish_with_message(format!("✓Downloading {}", list.id)); |
40 | 62 | ||
41 | Ok(()) | 63 | Ok(()) |
42 | } | 64 | } |
43 | 65 | ||
44 | async fn download_version(config: Cfg, list: List, version: Version, mut cached: HashMap<String, String>, progress: ProgressBar) -> MLE<()> { | 66 | async fn download_version( |
67 | config: Cfg, | ||
68 | list: List, | ||
69 | version: Version, | ||
70 | mut cached: HashMap<String, String>, | ||
71 | progress: ProgressBar, | ||
72 | ) -> MLE<()> { | ||
45 | let project_info = mods_get_info(&config, &version.project_id)?; | 73 | let project_info = mods_get_info(&config, &version.project_id)?; |
46 | 74 | ||
47 | let dl_path = String::from(&list.download_folder); | 75 | let dl_path = String::from(&list.download_folder); |
@@ -59,7 +87,7 @@ async fn download_version(config: Cfg, list: List, version: Version, mut cached: | |||
59 | let files = version.files; | 87 | let files = version.files; |
60 | let file = match files.clone().into_iter().find(|f| f.primary) { | 88 | let file = match files.clone().into_iter().find(|f| f.primary) { |
61 | Some(f) => f, | 89 | Some(f) => f, |
62 | None => files[0].clone() | 90 | None => files[0].clone(), |
63 | }; | 91 | }; |
64 | let mut splitname: Vec<&str> = file.filename.split('.').collect(); | 92 | let mut splitname: Vec<&str> = file.filename.split('.').collect(); |
65 | let extension = match splitname.pop().ok_or("") { | 93 | let extension = match splitname.pop().ok_or("") { |
@@ -74,13 +102,7 @@ async fn download_version(config: Cfg, list: List, version: Version, mut cached: | |||
74 | extension | 102 | extension |
75 | ); | 103 | ); |
76 | 104 | ||
77 | download_file( | 105 | download_file(&file.url, &list.download_folder, &filename, &progress).await?; |
78 | &file.url, | ||
79 | &list.download_folder, | ||
80 | &filename, | ||
81 | &progress | ||
82 | ) | ||
83 | .await?; | ||
84 | 106 | ||
85 | progress.set_message(format!("Copy {} to cache", version.id)); | 107 | progress.set_message(format!("Copy {} to cache", version.id)); |
86 | let dl_path_file = format!("{}/{}", list.download_folder, filename); | 108 | let dl_path_file = format!("{}/{}", list.download_folder, filename); |
@@ -89,7 +111,10 @@ async fn download_version(config: Cfg, list: List, version: Version, mut cached: | |||
89 | copy(dl_path_file, cache_path)?; | 111 | copy(dl_path_file, cache_path)?; |
90 | } | 112 | } |
91 | 113 | ||
92 | progress.finish_with_message(format!("✓{} - {}{}", project_info.title, version.id, cache_msg)); | 114 | progress.finish_with_message(format!( |
115 | "✓{} - {}{}", | ||
116 | project_info.title, version.id, cache_msg | ||
117 | )); | ||
93 | 118 | ||
94 | Ok(()) | 119 | Ok(()) |
95 | } | 120 | } |
@@ -117,7 +142,7 @@ async fn download_file(url: &str, path: &str, name: &str, progress: &ProgressBar | |||
117 | // progress.inc(1); | 142 | // progress.inc(1); |
118 | let chunk = item?; | 143 | let chunk = item?; |
119 | file.write_all(&chunk)?; | 144 | file.write_all(&chunk)?; |
120 | 145 | ||
121 | // Progress bar | 146 | // Progress bar |
122 | let new = min(downloaded + (chunk.len() as u64), size); | 147 | let new = min(downloaded + (chunk.len() as u64), size); |
123 | downloaded = new; | 148 | downloaded = new; |
@@ -136,7 +161,7 @@ pub fn disable_version( | |||
136 | mod_id: String, | 161 | mod_id: String, |
137 | ) -> MLE<()> { | 162 | ) -> MLE<()> { |
138 | //println!("Disabling version {} for mod {}", versionid, mod_id); | 163 | //println!("Disabling version {} for mod {}", versionid, mod_id); |
139 | let file = get_file_path(current_list.clone(), String::from(&versionid))?; | 164 | let file = get_file_path(¤t_list, String::from(&versionid))?; |
140 | let disabled = format!("{}.disabled", file); | 165 | let disabled = format!("{}.disabled", file); |
141 | 166 | ||
142 | rename(file, disabled)?; | 167 | rename(file, disabled)?; |
@@ -146,7 +171,7 @@ pub fn disable_version( | |||
146 | Ok(()) | 171 | Ok(()) |
147 | } | 172 | } |
148 | 173 | ||
149 | pub fn delete_version(list: List, version: String) -> MLE<()> { | 174 | pub fn delete_version(list: &List, version: String) -> MLE<()> { |
150 | let file = get_file_path(list, version)?; | 175 | let file = get_file_path(list, version)?; |
151 | 176 | ||
152 | remove_file(file)?; | 177 | remove_file(file)?; |
@@ -154,9 +179,9 @@ pub fn delete_version(list: List, version: String) -> MLE<()> { | |||
154 | Ok(()) | 179 | Ok(()) |
155 | } | 180 | } |
156 | 181 | ||
157 | pub fn get_file_path(list: List, versionid: String) -> MLE<String> { | 182 | pub fn get_file_path(list: &List, versionid: String) -> MLE<String> { |
158 | let mut names: HashMap<String, String> = HashMap::new(); | 183 | let mut names: HashMap<String, String> = HashMap::new(); |
159 | for file in read_dir(list.download_folder)? { | 184 | for file in read_dir(&list.download_folder)? { |
160 | let path = file?.path(); | 185 | let path = file?.path(); |
161 | if path.is_file() { | 186 | if path.is_file() { |
162 | let pathstr = match path.to_str().ok_or("") { | 187 | let pathstr = match path.to_str().ok_or("") { |
@@ -6,20 +6,26 @@ pub mod db; | |||
6 | pub mod error; | 6 | pub mod error; |
7 | pub mod files; | 7 | pub mod files; |
8 | 8 | ||
9 | use std::{fmt::Display, fs::{File, remove_file, self}, io::{Write, Read}, time::Duration}; | 9 | use std::{ |
10 | fmt::Display, | ||
11 | fs::{self, remove_file, File}, | ||
12 | io::{Read, Write}, | ||
13 | time::Duration, | ||
14 | }; | ||
10 | 15 | ||
11 | pub use apis::*; | ||
12 | use apis::modrinth::{get_game_versions, GameVersion, GameVersionType}; | 16 | use apis::modrinth::{get_game_versions, GameVersion, GameVersionType}; |
17 | pub use apis::*; | ||
13 | pub use commands::*; | 18 | pub use commands::*; |
14 | use error::{ErrorType, MLError, MLE}; | 19 | use error::{ErrorType, MLError, MLE}; |
15 | use indicatif::{ProgressStyle, ProgressBar}; | 20 | use indicatif::{ProgressBar, ProgressStyle}; |
16 | use serde::{Deserialize, Serialize}; | 21 | use serde::{Deserialize, Serialize}; |
17 | 22 | ||
18 | pub static STYLE_BAR_BYTE: &str = "{spinner:.green}{wide_msg}{bytes}/{total_bytes} [{bar:.green/lime}]"; | 23 | pub static STYLE_BAR_BYTE: &str = |
24 | "{spinner:.green}{wide_msg}{bytes}/{total_bytes} [{bar:.green/lime}]"; | ||
19 | pub static STYLE_BAR_POS: &str = " {wide_msg}{pos}/{len} [{bar:.green/lime}]"; | 25 | pub static STYLE_BAR_POS: &str = " {wide_msg}{pos}/{len} [{bar:.green/lime}]"; |
20 | pub static STYLE_SPINNER: &str = "{spinner:.green}{wide_msg}"; | 26 | pub static STYLE_SPINNER: &str = "{spinner:.green}{wide_msg}"; |
21 | pub static STYLE_OPERATION: &str = " {wide_msg}"; | 27 | pub static STYLE_OPERATION: &str = " {wide_msg}"; |
22 | pub static STYLE_MESSAGE: &str = "{wide_msg}"; | 28 | pub static STYLE_MESSAGE: &str = "{wide_msg}"; |
23 | pub static PROGRESS_CHARS: &str = "#>-"; | 29 | pub static PROGRESS_CHARS: &str = "#>-"; |
24 | 30 | ||
25 | #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] | 31 | #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] |
@@ -59,7 +65,7 @@ pub enum VersionLevel { | |||
59 | Release, | 65 | Release, |
60 | #[serde(rename(serialize = "snapshot", deserialize = "snapshot"))] | 66 | #[serde(rename(serialize = "snapshot", deserialize = "snapshot"))] |
61 | Snapshot, | 67 | Snapshot, |
62 | Version(String) | 68 | Version(String), |
63 | } | 69 | } |
64 | 70 | ||
65 | /// Checks if update needed (time) | 71 | /// Checks if update needed (time) |
@@ -70,7 +76,9 @@ pub async fn check_game_versions(path: &str, force: bool) -> MLE<()> { | |||
70 | p.set_message("Update minecraft versions"); | 76 | p.set_message("Update minecraft versions"); |
71 | 77 | ||
72 | let creation_time = fs::metadata(path)?.created()?; | 78 | let creation_time = fs::metadata(path)?.created()?; |
73 | if !force && creation_time.elapsed().unwrap() < Duration::from_secs(60 * 60 * 24) { return Ok(()); } | 79 | if !force && creation_time.elapsed().unwrap() < Duration::from_secs(60 * 60 * 24) { |
80 | return Ok(()); | ||
81 | } | ||
74 | 82 | ||
75 | let versions = get_game_versions().await; | 83 | let versions = get_game_versions().await; |
76 | remove_file(path)?; | 84 | remove_file(path)?; |
@@ -91,7 +99,6 @@ pub fn load_game_versions(path: &str) -> MLE<Vec<GameVersion>> { | |||
91 | } | 99 | } |
92 | 100 | ||
93 | impl VersionLevel { | 101 | impl VersionLevel { |
94 | |||
95 | pub fn from(str: &str) -> Self { | 102 | pub fn from(str: &str) -> Self { |
96 | match str { | 103 | match str { |
97 | "release" => VersionLevel::Release, | 104 | "release" => VersionLevel::Release, |
@@ -107,22 +114,29 @@ impl VersionLevel { | |||
107 | 114 | ||
108 | match self { | 115 | match self { |
109 | VersionLevel::Release => { | 116 | VersionLevel::Release => { |
110 | let release = versions.find(|ver| ver.version_type == GameVersionType::release).unwrap(); | 117 | let release = versions |
118 | .find(|ver| ver.version_type == GameVersionType::release) | ||
119 | .unwrap(); | ||
111 | println!("{:?}", release); | 120 | println!("{:?}", release); |
112 | Ok(release.version) | 121 | Ok(release.version) |
113 | }, | 122 | } |
114 | VersionLevel::Snapshot => { | 123 | VersionLevel::Snapshot => { |
115 | let snapshot = versions.find(|ver| ver.version_type == GameVersionType::snapshot).unwrap(); | 124 | let snapshot = versions |
125 | .find(|ver| ver.version_type == GameVersionType::snapshot) | ||
126 | .unwrap(); | ||
116 | println!("{:?}", snapshot); | 127 | println!("{:?}", snapshot); |
117 | Ok(snapshot.version) | 128 | Ok(snapshot.version) |
118 | }, | 129 | } |
119 | VersionLevel::Version(v) => { | 130 | VersionLevel::Version(v) => { |
120 | if versions.any(|ver| ver.version == v) { | 131 | if versions.any(|ver| ver.version == v) { |
121 | Ok(v) | 132 | Ok(v) |
122 | } else { | 133 | } else { |
123 | Err(MLError::new(ErrorType::ConfigError, "unknown minecraft version")) | 134 | Err(MLError::new( |
135 | ErrorType::ConfigError, | ||
136 | "unknown minecraft version", | ||
137 | )) | ||
124 | } | 138 | } |
125 | }, | 139 | } |
126 | } | 140 | } |
127 | } | 141 | } |
128 | } | 142 | } |
diff --git a/src/main.rs b/src/main.rs index d03f88a..d9ad6af 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -2,8 +2,8 @@ use clap::{Parser, Subcommand}; | |||
2 | use modlist::{ | 2 | use modlist::{ |
3 | config::Cfg, | 3 | config::Cfg, |
4 | db::{config_get_current_list, lists_get, lists_get_all_ids}, | 4 | db::{config_get_current_list, lists_get, lists_get_all_ids}, |
5 | download, export, get_current_list, import, list_add, list_change, list_remove, list_version, | 5 | download, export, get_current_list, import, list_add, list_change, list_list, list_remove, |
6 | mod_add, mod_remove, update, IDSelector, List, Modloader, VersionLevel, list_list, AddMod, | 6 | list_version, mod_add, mod_remove, update, AddMod, IDSelector, List, Modloader, VersionLevel, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | #[derive(Parser)] | 9 | #[derive(Parser)] |
@@ -43,7 +43,7 @@ enum Commands { | |||
43 | /// remove disabled versions | 43 | /// remove disabled versions |
44 | #[arg(short, long)] | 44 | #[arg(short, long)] |
45 | remove: bool, | 45 | remove: bool, |
46 | 46 | ||
47 | /// optional List selection, else default list will be used | 47 | /// optional List selection, else default list will be used |
48 | #[arg(short, long)] | 48 | #[arg(short, long)] |
49 | list: Option<String>, | 49 | list: Option<String>, |
@@ -81,7 +81,7 @@ enum Commands { | |||
81 | /// the list you want to export | 81 | /// the list you want to export |
82 | list: Option<String>, | 82 | list: Option<String>, |
83 | }, | 83 | }, |
84 | Test | 84 | Test, |
85 | } | 85 | } |
86 | 86 | ||
87 | #[derive(Subcommand)] | 87 | #[derive(Subcommand)] |
@@ -160,86 +160,87 @@ async fn main() { | |||
160 | let config = Cfg::init(cli.config).await.unwrap(); | 160 | let config = Cfg::init(cli.config).await.unwrap(); |
161 | 161 | ||
162 | match cli.command { | 162 | match cli.command { |
163 | Commands::Mod { command } => { | 163 | Commands::Mod { command } => match command { |
164 | match command { | 164 | ModCommands::Add { |
165 | ModCommands::Add { | 165 | id, |
166 | id, | 166 | version, |
167 | version, | 167 | list, |
168 | list, | 168 | download, |
169 | download, | 169 | lock, |
170 | lock, | 170 | } => { |
171 | } => { | 171 | let listf = match list { |
172 | let listf = match list { | 172 | Some(list) => lists_get(&config, &list).unwrap(), |
173 | Some(list) => lists_get(&config, &list).unwrap(), | 173 | None => lists_get(&config, &config_get_current_list(&config).unwrap()).unwrap(), |
174 | None => lists_get( | 174 | }; |
175 | &config, | ||
176 | &config_get_current_list(&config).unwrap(), | ||
177 | ) | ||
178 | .unwrap(), | ||
179 | }; | ||
180 | 175 | ||
181 | let marked_id = match version { | 176 | let marked_id = match version { |
182 | true => IDSelector::VersionID(id), | 177 | true => IDSelector::VersionID(id), |
183 | false => IDSelector::ModificationID(id), | 178 | false => IDSelector::ModificationID(id), |
184 | }; | 179 | }; |
185 | 180 | ||
186 | let add_id = AddMod { id: marked_id, set_version: lock }; | 181 | let add_id = AddMod { |
182 | id: marked_id, | ||
183 | set_version: lock, | ||
184 | }; | ||
187 | 185 | ||
188 | mod_add(&config, vec![add_id], listf, download).await | 186 | mod_add(&config, vec![add_id], listf, download).await |
189 | } | ||
190 | ModCommands::Remove { id, list } => { | ||
191 | let listf = match list { | ||
192 | Some(list) => lists_get(&config, &list).unwrap(), | ||
193 | None => lists_get( | ||
194 | &config, | ||
195 | &config_get_current_list(&config).unwrap(), | ||
196 | ) | ||
197 | .unwrap(), | ||
198 | }; | ||
199 | mod_remove(&config, &id, listf) | ||
200 | } | ||
201 | } | 187 | } |
202 | } | 188 | ModCommands::Remove { id, list } => { |
203 | Commands::List { command, force_gameupdate } => { | 189 | let listf = match list { |
204 | match command { | 190 | Some(list) => lists_get(&config, &list).unwrap(), |
205 | ListCommands::Add { | 191 | None => lists_get(&config, &config_get_current_list(&config).unwrap()).unwrap(), |
206 | id, | 192 | }; |
207 | directory, | 193 | mod_remove(&config, &id, &listf) |
208 | modloader, | ||
209 | version, | ||
210 | } => { | ||
211 | let ml = match modloader { | ||
212 | Some(ml) => Modloader::from(&ml).unwrap(), | ||
213 | None => config.defaults.modloader.clone(), | ||
214 | }; | ||
215 | |||
216 | let versions_path = &config.versions; | ||
217 | let ver = match version { | ||
218 | Some(ver) => VersionLevel::from(&ver).get(versions_path, force_gameupdate).await.unwrap(), | ||
219 | None => config.defaults.version.clone().get(versions_path, force_gameupdate).await.unwrap(), | ||
220 | }; | ||
221 | |||
222 | list_add(&config, &id, &ver, &ml, &directory) | ||
223 | } | ||
224 | ListCommands::Remove { id } => list_remove(&config, id), | ||
225 | ListCommands::List => { | ||
226 | list_list(&config) | ||
227 | } | ||
228 | ListCommands::Change { id } => list_change(&config, id), | ||
229 | ListCommands::Version { | ||
230 | id, | ||
231 | version, | ||
232 | download, | ||
233 | remove, | ||
234 | } => list_version(&config, &id, version, download, remove).await, | ||
235 | } | 194 | } |
236 | } | 195 | }, |
196 | Commands::List { | ||
197 | command, | ||
198 | force_gameupdate, | ||
199 | } => match command { | ||
200 | ListCommands::Add { | ||
201 | id, | ||
202 | directory, | ||
203 | modloader, | ||
204 | version, | ||
205 | } => { | ||
206 | let ml = match modloader { | ||
207 | Some(ml) => Modloader::from(&ml).unwrap(), | ||
208 | None => config.defaults.modloader.clone(), | ||
209 | }; | ||
210 | |||
211 | let versions_path = &config.versions; | ||
212 | let ver = match version { | ||
213 | Some(ver) => VersionLevel::from(&ver) | ||
214 | .get(versions_path, force_gameupdate) | ||
215 | .await | ||
216 | .unwrap(), | ||
217 | None => config | ||
218 | .defaults | ||
219 | .version | ||
220 | .clone() | ||
221 | .get(versions_path, force_gameupdate) | ||
222 | .await | ||
223 | .unwrap(), | ||
224 | }; | ||
225 | |||
226 | list_add(&config, &id, &ver, &ml, &directory) | ||
227 | } | ||
228 | ListCommands::Remove { id } => list_remove(&config, &id), | ||
229 | ListCommands::List => list_list(&config), | ||
230 | ListCommands::Change { id } => list_change(&config, &id), | ||
231 | ListCommands::Version { | ||
232 | id, | ||
233 | version, | ||
234 | download, | ||
235 | remove, | ||
236 | } => list_version(&config, &id, version, download, remove).await, | ||
237 | }, | ||
237 | Commands::Update { | 238 | Commands::Update { |
238 | all, | 239 | all, |
239 | download, | 240 | download, |
240 | clean, | 241 | clean, |
241 | remove, | 242 | remove, |
242 | list | 243 | list, |
243 | } => { | 244 | } => { |
244 | let mut liststack: Vec<List> = vec![]; | 245 | let mut liststack: Vec<List> = vec![]; |
245 | if all { | 246 | if all { |
@@ -248,7 +249,7 @@ async fn main() { | |||
248 | liststack.push(lists_get(&config, &id).unwrap()); | 249 | liststack.push(lists_get(&config, &id).unwrap()); |
249 | } | 250 | } |
250 | } else { | 251 | } else { |
251 | let current = match list { | 252 | let current = match list { |
252 | Some(l) => lists_get(&config, &l).unwrap(), | 253 | Some(l) => lists_get(&config, &l).unwrap(), |
253 | None => get_current_list(&config).unwrap(), | 254 | None => get_current_list(&config).unwrap(), |
254 | }; | 255 | }; |
@@ -257,7 +258,12 @@ async fn main() { | |||
257 | 258 | ||
258 | update(&config, liststack, clean, download, remove).await | 259 | update(&config, liststack, clean, download, remove).await |
259 | } | 260 | } |
260 | Commands::Download { all, clean, remove, list } => { | 261 | Commands::Download { |
262 | all, | ||
263 | clean, | ||
264 | remove, | ||
265 | list, | ||
266 | } => { | ||
261 | let mut liststack: Vec<List> = vec![]; | 267 | let mut liststack: Vec<List> = vec![]; |
262 | if all { | 268 | if all { |
263 | let list_ids = lists_get_all_ids(&config).unwrap(); | 269 | let list_ids = lists_get_all_ids(&config).unwrap(); |
@@ -265,15 +271,15 @@ async fn main() { | |||
265 | liststack.push(lists_get(&config, &id).unwrap()); | 271 | liststack.push(lists_get(&config, &id).unwrap()); |
266 | } | 272 | } |
267 | } else { | 273 | } else { |
268 | let current = match list { | 274 | let current = match list { |
269 | Some(l) => lists_get(&config, &l).unwrap(), | 275 | Some(l) => lists_get(&config, &l).unwrap(), |
270 | None => get_current_list(&config).unwrap(), | 276 | None => get_current_list(&config).unwrap(), |
271 | }; | 277 | }; |
272 | liststack.push(current) | 278 | liststack.push(current) |
273 | } | 279 | } |
274 | 280 | ||
275 | download(&config, liststack, clean, remove).await | 281 | download(&config, liststack, clean, remove).await |
276 | }, | 282 | } |
277 | Commands::Import { file, download } => { | 283 | Commands::Import { file, download } => { |
278 | let filestr: String = match file { | 284 | let filestr: String = match file { |
279 | Some(args) => args, | 285 | Some(args) => args, |