diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index 82c0ade..93da718 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -3,7 +3,7 @@ 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_remove, list_version, |
6 | mod_add, mod_remove, update, IDSelector, List, Modloader, | 6 | mod_add, mod_remove, update, IDSelector, List, Modloader, check_game_versions, VersionLevel, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | //TODO implement remote sql db | 9 | //TODO implement remote sql db |
@@ -18,6 +18,10 @@ struct Cli { | |||
18 | /// config file path | 18 | /// config file path |
19 | #[arg(short, long)] | 19 | #[arg(short, long)] |
20 | config: Option<String>, | 20 | config: Option<String>, |
21 | |||
22 | /// Force GameVersion update | ||
23 | #[arg(long)] | ||
24 | force_gameupdate: bool, | ||
21 | } | 25 | } |
22 | 26 | ||
23 | #[derive(Subcommand)] | 27 | #[derive(Subcommand)] |
@@ -72,6 +76,7 @@ enum Commands { | |||
72 | /// the list you want to export | 76 | /// the list you want to export |
73 | list: Option<String>, | 77 | list: Option<String>, |
74 | }, | 78 | }, |
79 | Test | ||
75 | } | 80 | } |
76 | 81 | ||
77 | #[derive(Subcommand)] | 82 | #[derive(Subcommand)] |
@@ -147,7 +152,8 @@ enum ListCommands { | |||
147 | async fn main() { | 152 | async fn main() { |
148 | let cli = Cli::parse(); | 153 | let cli = Cli::parse(); |
149 | 154 | ||
150 | let config = Cfg::init(cli.config).unwrap(); | 155 | let config = Cfg::init(cli.config).await.unwrap(); |
156 | check_game_versions(format!("{}/versions.json", config.versions).as_str(), cli.force_gameupdate).await.unwrap(); | ||
151 | 157 | ||
152 | match cli.command { | 158 | match cli.command { |
153 | Commands::Mod { command } => { | 159 | Commands::Mod { command } => { |
@@ -204,11 +210,10 @@ async fn main() { | |||
204 | None => config.clone().defaults.modloader, | 210 | None => config.clone().defaults.modloader, |
205 | }; | 211 | }; |
206 | 212 | ||
213 | let versions_path = &config.versions; | ||
207 | let ver = match version { | 214 | let ver = match version { |
208 | Some(ver) => ver, | 215 | Some(ver) => VersionLevel::from(&ver).get(versions_path).unwrap(), |
209 | //TODO get latest version | 216 | None => config.clone().defaults.version.get(versions_path).unwrap(), |
210 | //TODO impl config for specific version or latest or latest snap | ||
211 | None => "1.19.4".to_string(), | ||
212 | }; | 217 | }; |
213 | 218 | ||
214 | list_add(config, id, ver, ml, directory) | 219 | list_add(config, id, ver, ml, directory) |
@@ -262,6 +267,7 @@ async fn main() { | |||
262 | import(config, filestr, download).await | 267 | import(config, filestr, download).await |
263 | } | 268 | } |
264 | Commands::Export { list } => export(config, list), | 269 | Commands::Export { list } => export(config, list), |
270 | Commands::Test => Ok(()), | ||
265 | } | 271 | } |
266 | .unwrap(); | 272 | .unwrap(); |
267 | } | 273 | } |