diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/main.rs b/src/main.rs index 53cbe71..3bc2ba0 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -3,11 +3,9 @@ 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, VersionLevel, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | //TODO implement remote sql db | ||
10 | |||
11 | //TODO make default list optional | 9 | //TODO make default list optional |
12 | #[derive(Parser)] | 10 | #[derive(Parser)] |
13 | #[command(author, version, about)] | 11 | #[command(author, version, about)] |
@@ -18,6 +16,10 @@ struct Cli { | |||
18 | /// config file path | 16 | /// config file path |
19 | #[arg(short, long)] | 17 | #[arg(short, long)] |
20 | config: Option<String>, | 18 | config: Option<String>, |
19 | |||
20 | /// Force GameVersion update | ||
21 | #[arg(long)] | ||
22 | force_gameupdate: bool, | ||
21 | } | 23 | } |
22 | 24 | ||
23 | #[derive(Subcommand)] | 25 | #[derive(Subcommand)] |
@@ -72,6 +74,7 @@ enum Commands { | |||
72 | /// the list you want to export | 74 | /// the list you want to export |
73 | list: Option<String>, | 75 | list: Option<String>, |
74 | }, | 76 | }, |
77 | Test | ||
75 | } | 78 | } |
76 | 79 | ||
77 | #[derive(Subcommand)] | 80 | #[derive(Subcommand)] |
@@ -147,7 +150,7 @@ enum ListCommands { | |||
147 | async fn main() { | 150 | async fn main() { |
148 | let cli = Cli::parse(); | 151 | let cli = Cli::parse(); |
149 | 152 | ||
150 | let config = Cfg::init(cli.config).unwrap(); | 153 | let config = Cfg::init(cli.config).await.unwrap(); |
151 | 154 | ||
152 | match cli.command { | 155 | match cli.command { |
153 | Commands::Mod { command } => { | 156 | Commands::Mod { command } => { |
@@ -201,15 +204,13 @@ async fn main() { | |||
201 | } => { | 204 | } => { |
202 | let ml = match modloader { | 205 | let ml = match modloader { |
203 | Some(ml) => Modloader::from(&ml).unwrap(), | 206 | Some(ml) => Modloader::from(&ml).unwrap(), |
204 | //TODO add default modloader to config | 207 | None => config.clone().defaults.modloader, |
205 | None => Modloader::Fabric, | ||
206 | }; | 208 | }; |
207 | 209 | ||
210 | let versions_path = &config.versions; | ||
208 | let ver = match version { | 211 | let ver = match version { |
209 | Some(ver) => ver, | 212 | Some(ver) => VersionLevel::from(&ver).get(versions_path, cli.force_gameupdate).await.unwrap(), |
210 | //TODO get latest version | 213 | None => config.clone().defaults.version.get(versions_path, cli.force_gameupdate).await.unwrap(), |
211 | //TODO impl config for specific version or latest or latest snap | ||
212 | None => "1.19.4".to_string(), | ||
213 | }; | 214 | }; |
214 | 215 | ||
215 | list_add(config, id, ver, ml, directory) | 216 | list_add(config, id, ver, ml, directory) |
@@ -263,6 +264,7 @@ async fn main() { | |||
263 | import(config, filestr, download).await | 264 | import(config, filestr, download).await |
264 | } | 265 | } |
265 | Commands::Export { list } => export(config, list), | 266 | Commands::Export { list } => export(config, list), |
267 | Commands::Test => Ok(()), | ||
266 | } | 268 | } |
267 | .unwrap(); | 269 | .unwrap(); |
268 | } | 270 | } |