diff options
author | fxqnlr <[email protected]> | 2023-01-22 22:34:17 +0100 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-01-22 22:34:17 +0100 |
commit | 1890d59428dfcca861ea1b7820411d80cc60d713 (patch) | |
tree | 559a41a814a33a72ccab3640a6c81d10451f1683 /src/commands/list.rs | |
parent | f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537 (diff) | |
download | modlist-1890d59428dfcca861ea1b7820411d80cc60d713.tar modlist-1890d59428dfcca861ea1b7820411d80cc60d713.tar.gz modlist-1890d59428dfcca861ea1b7820411d80cc60d713.zip |
Added list version cmd, fixed some todos
Diffstat (limited to 'src/commands/list.rs')
-rw-r--r-- | src/commands/list.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/commands/list.rs b/src/commands/list.rs index bc58787..eaf6fa1 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use crate::{db::{lists_insert, lists_remove, config_change_current_list, config_get_current_list, lists_get}, Modloader, config::Cfg, input::{Input, ListOptions}, /*cmd_update,*/ error::MLE, /*modrinth::MCVersionType*/}; | 1 | use crate::{db::{lists_insert, lists_remove, config_change_current_list, config_get_current_list, lists_get, lists_version}, Modloader, config::Cfg, input::{Input, ListOptions}, cmd_update, error::MLE}; |
2 | 2 | ||
3 | #[derive(Debug, Clone, PartialEq, Eq)] | 3 | #[derive(Debug, Clone, PartialEq, Eq)] |
4 | pub struct List { | 4 | pub struct List { |
@@ -20,13 +20,9 @@ pub async fn list(config: Cfg, input: Input) -> MLE<()> { | |||
20 | ListOptions::Remove => { | 20 | ListOptions::Remove => { |
21 | remove(config, input) | 21 | remove(config, input) |
22 | }, | 22 | }, |
23 | /* | 23 | ListOptions::Version => { |
24 | Subcmd::Version => { | 24 | version(config, input).await |
25 | match version(config, Some(input.args.ok_or("NO_VERSION")?), Some(MCVersionType::Release)).await { | 25 | } |
26 | Ok(..) => Ok(()), | ||
27 | Err(e) => Err(Box::new(e)) | ||
28 | } | ||
29 | }*/ | ||
30 | } | 26 | } |
31 | } | 27 | } |
32 | 28 | ||
@@ -44,7 +40,7 @@ fn add(config: Cfg, input: Input) -> MLE<()> { | |||
44 | } | 40 | } |
45 | 41 | ||
46 | fn change(config: Cfg, input: Input) -> MLE<()> { | 42 | fn change(config: Cfg, input: Input) -> MLE<()> { |
47 | //TODO reimplement current list | 43 | println!("Change default list to: {}", input.clone().list.unwrap().id); |
48 | config_change_current_list(config, input.list.unwrap().id) | 44 | config_change_current_list(config, input.list.unwrap().id) |
49 | } | 45 | } |
50 | 46 | ||
@@ -52,17 +48,19 @@ fn remove(config: Cfg, input: Input) -> MLE<()> { | |||
52 | lists_remove(config, input.list.unwrap().id) | 48 | lists_remove(config, input.list.unwrap().id) |
53 | } | 49 | } |
54 | 50 | ||
55 | /* | ||
56 | ///Changing the current lists version and updating it | 51 | ///Changing the current lists version and updating it |
57 | /// #Arguments | 52 | /// #Arguments |
58 | /// | 53 | /// |
59 | /// * `config` - The current config | 54 | /// * `config` - The current config |
60 | /// * `args` - All args, to extract the new version | 55 | /// * `args` - All args, to extract the new version |
61 | async fn version(config: Cfg, args: Option<Vec<String>>, version_type: Option<MCVersionType>) -> MLE<()> { | 56 | async fn version(config: Cfg, input: Input) -> MLE<()> { |
62 | let current_list = lists_get(config.clone(), config_get_current_list(config.clone())?)?; | 57 | println!("Change version for list {} to minecraft version: {}", input.clone().list.unwrap().id, input.clone().list_mcversion.unwrap()); |
63 | 58 | ||
64 | lists_version(config.clone(), String::from(¤t_list.id), String::from(&args.unwrap()[0]))?; | 59 | lists_version(config.clone(), input.clone().list.ok_or("").unwrap().id, input.clone().list_mcversion.ok_or("").unwrap())?; |
65 | //update the list & with -- args | 60 | |
66 | cmd_update(config, vec![current_list], true, true, false).await | 61 | //Linebreak readability |
62 | println!(""); | ||
63 | |||
64 | println!("Check for updates for new minecraft version in list {}", input.clone().list.unwrap().id); | ||
65 | cmd_update(config, vec![input.list.ok_or("").unwrap()], true, input.direct_download, input.delete_old).await | ||
67 | } | 66 | } |
68 | */ | ||