diff options
-rw-r--r-- | Cargo.lock | 73 | ||||
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | src/main.rs | 10 |
3 files changed, 56 insertions, 30 deletions
@@ -39,42 +39,51 @@ dependencies = [ | |||
39 | 39 | ||
40 | [[package]] | 40 | [[package]] |
41 | name = "anstream" | 41 | name = "anstream" |
42 | version = "0.2.6" | 42 | version = "0.3.0" |
43 | source = "registry+https://github.com/rust-lang/crates.io-index" | 43 | source = "registry+https://github.com/rust-lang/crates.io-index" |
44 | checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" | 44 | checksum = "9e579a7752471abc2a8268df8b20005e3eadd975f585398f17efcfd8d4927371" |
45 | dependencies = [ | 45 | dependencies = [ |
46 | "anstyle", | 46 | "anstyle", |
47 | "anstyle-parse", | 47 | "anstyle-parse", |
48 | "anstyle-query", | ||
48 | "anstyle-wincon", | 49 | "anstyle-wincon", |
49 | "concolor-override", | 50 | "colorchoice", |
50 | "concolor-query", | ||
51 | "is-terminal", | 51 | "is-terminal", |
52 | "utf8parse", | 52 | "utf8parse", |
53 | ] | 53 | ] |
54 | 54 | ||
55 | [[package]] | 55 | [[package]] |
56 | name = "anstyle" | 56 | name = "anstyle" |
57 | version = "0.3.5" | 57 | version = "1.0.0" |
58 | source = "registry+https://github.com/rust-lang/crates.io-index" | 58 | source = "registry+https://github.com/rust-lang/crates.io-index" |
59 | checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" | 59 | checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" |
60 | 60 | ||
61 | [[package]] | 61 | [[package]] |
62 | name = "anstyle-parse" | 62 | name = "anstyle-parse" |
63 | version = "0.1.1" | 63 | version = "0.2.0" |
64 | source = "registry+https://github.com/rust-lang/crates.io-index" | 64 | source = "registry+https://github.com/rust-lang/crates.io-index" |
65 | checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" | 65 | checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" |
66 | dependencies = [ | 66 | dependencies = [ |
67 | "utf8parse", | 67 | "utf8parse", |
68 | ] | 68 | ] |
69 | 69 | ||
70 | [[package]] | 70 | [[package]] |
71 | name = "anstyle-query" | ||
72 | version = "1.0.0" | ||
73 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
74 | checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" | ||
75 | dependencies = [ | ||
76 | "windows-sys 0.48.0", | ||
77 | ] | ||
78 | |||
79 | [[package]] | ||
71 | name = "anstyle-wincon" | 80 | name = "anstyle-wincon" |
72 | version = "0.2.0" | 81 | version = "1.0.0" |
73 | source = "registry+https://github.com/rust-lang/crates.io-index" | 82 | source = "registry+https://github.com/rust-lang/crates.io-index" |
74 | checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" | 83 | checksum = "4bcd8291a340dd8ac70e18878bc4501dd7b4ff970cfa21c207d36ece51ea88fd" |
75 | dependencies = [ | 84 | dependencies = [ |
76 | "anstyle", | 85 | "anstyle", |
77 | "windows-sys 0.45.0", | 86 | "windows-sys 0.48.0", |
78 | ] | 87 | ] |
79 | 88 | ||
80 | [[package]] | 89 | [[package]] |
@@ -157,9 +166,9 @@ dependencies = [ | |||
157 | 166 | ||
158 | [[package]] | 167 | [[package]] |
159 | name = "clap" | 168 | name = "clap" |
160 | version = "4.2.1" | 169 | version = "4.2.2" |
161 | source = "registry+https://github.com/rust-lang/crates.io-index" | 170 | source = "registry+https://github.com/rust-lang/crates.io-index" |
162 | checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3" | 171 | checksum = "9b802d85aaf3a1cdb02b224ba472ebdea62014fccfcb269b95a4d76443b5ee5a" |
163 | dependencies = [ | 172 | dependencies = [ |
164 | "clap_builder", | 173 | "clap_builder", |
165 | "clap_derive", | 174 | "clap_derive", |
@@ -168,9 +177,9 @@ dependencies = [ | |||
168 | 177 | ||
169 | [[package]] | 178 | [[package]] |
170 | name = "clap_builder" | 179 | name = "clap_builder" |
171 | version = "4.2.1" | 180 | version = "4.2.2" |
172 | source = "registry+https://github.com/rust-lang/crates.io-index" | 181 | source = "registry+https://github.com/rust-lang/crates.io-index" |
173 | checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f" | 182 | checksum = "14a1a858f532119338887a4b8e1af9c60de8249cd7bafd68036a489e261e37b6" |
174 | dependencies = [ | 183 | dependencies = [ |
175 | "anstream", | 184 | "anstream", |
176 | "anstyle", | 185 | "anstyle", |
@@ -180,6 +189,15 @@ dependencies = [ | |||
180 | ] | 189 | ] |
181 | 190 | ||
182 | [[package]] | 191 | [[package]] |
192 | name = "clap_complete" | ||
193 | version = "4.2.0" | ||
194 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
195 | checksum = "01c22dcfb410883764b29953103d9ef7bb8fe21b3fa1158bc99986c2067294bd" | ||
196 | dependencies = [ | ||
197 | "clap", | ||
198 | ] | ||
199 | |||
200 | [[package]] | ||
183 | name = "clap_derive" | 201 | name = "clap_derive" |
184 | version = "4.2.0" | 202 | version = "4.2.0" |
185 | source = "registry+https://github.com/rust-lang/crates.io-index" | 203 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -208,19 +226,10 @@ dependencies = [ | |||
208 | ] | 226 | ] |
209 | 227 | ||
210 | [[package]] | 228 | [[package]] |
211 | name = "concolor-override" | 229 | name = "colorchoice" |
212 | version = "1.0.0" | 230 | version = "1.0.0" |
213 | source = "registry+https://github.com/rust-lang/crates.io-index" | 231 | source = "registry+https://github.com/rust-lang/crates.io-index" |
214 | checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" | 232 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" |
215 | |||
216 | [[package]] | ||
217 | name = "concolor-query" | ||
218 | version = "0.3.3" | ||
219 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
220 | checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" | ||
221 | dependencies = [ | ||
222 | "windows-sys 0.45.0", | ||
223 | ] | ||
224 | 233 | ||
225 | [[package]] | 234 | [[package]] |
226 | name = "core-foundation" | 235 | name = "core-foundation" |
@@ -789,10 +798,11 @@ dependencies = [ | |||
789 | 798 | ||
790 | [[package]] | 799 | [[package]] |
791 | name = "modlist" | 800 | name = "modlist" |
792 | version = "0.11.1" | 801 | version = "0.12.0" |
793 | dependencies = [ | 802 | dependencies = [ |
794 | "chrono", | 803 | "chrono", |
795 | "clap", | 804 | "clap", |
805 | "clap_complete", | ||
796 | "dirs", | 806 | "dirs", |
797 | "error-chain", | 807 | "error-chain", |
798 | "futures-util", | 808 | "futures-util", |
@@ -1661,6 +1671,15 @@ dependencies = [ | |||
1661 | ] | 1671 | ] |
1662 | 1672 | ||
1663 | [[package]] | 1673 | [[package]] |
1674 | name = "windows-sys" | ||
1675 | version = "0.48.0" | ||
1676 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1677 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" | ||
1678 | dependencies = [ | ||
1679 | "windows-targets 0.48.0", | ||
1680 | ] | ||
1681 | |||
1682 | [[package]] | ||
1664 | name = "windows-targets" | 1683 | name = "windows-targets" |
1665 | version = "0.42.2" | 1684 | version = "0.42.2" |
1666 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1685 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1,6 +1,6 @@ | |||
1 | [package] | 1 | [package] |
2 | name = "modlist" | 2 | name = "modlist" |
3 | version = "0.11.1" | 3 | version = "0.12.0" |
4 | edition = "2021" | 4 | edition = "2021" |
5 | 5 | ||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html |
@@ -17,3 +17,4 @@ toml = "0.7.2" | |||
17 | error-chain = "0.12.4" | 17 | error-chain = "0.12.4" |
18 | dirs = "5.0.0" | 18 | dirs = "5.0.0" |
19 | clap = { version = "4.2.1", features = ["derive"] } | 19 | clap = { version = "4.2.1", features = ["derive"] } |
20 | clap_complete = "4.2.0" | ||
diff --git a/src/main.rs b/src/main.rs index 0dfc190..a9071f1 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,8 +1,7 @@ | |||
1 | use clap::{Parser, Subcommand}; | 1 | use clap::{Parser, Subcommand, CommandFactory}; |
2 | use modlist::{config::Cfg, mod_add, mod_remove, db::{lists_get, config_get_current_list, lists_get_all_ids}, IDSelector, download, update, List, get_current_list, import, devdir, export, list_add, Modloader, list_version, list_remove, list_change}; | 2 | use modlist::{config::Cfg, mod_add, mod_remove, db::{lists_get, config_get_current_list, lists_get_all_ids}, IDSelector, download, update, List, get_current_list, import, devdir, export, list_add, Modloader, list_version, list_remove, list_change}; |
3 | 3 | ||
4 | //TODO make default list optional | 4 | //TODO make default list optional |
5 | |||
6 | #[derive(Parser)] | 5 | #[derive(Parser)] |
7 | #[command(author, version, about)] | 6 | #[command(author, version, about)] |
8 | struct Cli { | 7 | struct Cli { |
@@ -61,6 +60,9 @@ enum Commands { | |||
61 | Export { | 60 | Export { |
62 | /// the list you want to export | 61 | /// the list you want to export |
63 | list: Option<String> | 62 | list: Option<String> |
63 | }, | ||
64 | Completions { | ||
65 | shell: clap_complete::Shell, | ||
64 | } | 66 | } |
65 | } | 67 | } |
66 | 68 | ||
@@ -233,5 +235,9 @@ async fn main() { | |||
233 | Commands::Export { list } => { | 235 | Commands::Export { list } => { |
234 | export(config, list) | 236 | export(config, list) |
235 | }, | 237 | }, |
238 | Commands::Completions { shell } => { | ||
239 | clap_complete::generate(shell, &mut Cli::command(), "modlist", &mut std::io::stdout()); | ||
240 | Ok(()) | ||
241 | } | ||
236 | }.unwrap(); | 242 | }.unwrap(); |
237 | } | 243 | } |