summaryrefslogtreecommitdiff
path: root/src/commands/list.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/list.rs')
-rw-r--r--src/commands/list.rs30
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 @@
1use 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*/}; 1use 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)]
4pub struct List { 4pub 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
46fn change(config: Cfg, input: Input) -> MLE<()> { 42fn 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
61async fn version(config: Cfg, args: Option<Vec<String>>, version_type: Option<MCVersionType>) -> MLE<()> { 56async 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(&current_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*/