From 30c1ffcecb541d9b27982df6af26948514cbadaa Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Sun, 15 Jan 2023 16:58:45 +0100 Subject: started implementation of new input system --- src/commands/list.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/commands/list.rs') diff --git a/src/commands/list.rs b/src/commands/list.rs index 3998cce..2fec1c7 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -1,6 +1,6 @@ use std::io::{Error, ErrorKind}; -use crate::{db::{lists_insert, lists_remove, config_change_current_list, lists_get_all_ids, config_get_current_list, lists_get, lists_version}, Modloader, config::Cfg, input::{Input, Subcmd}, cmd_update, error::{MLE, ErrorType, MLError}, modrinth::MCVersionType}; +use crate::{db::{lists_insert, lists_remove, config_change_current_list, lists_get_all_ids, config_get_current_list, lists_get, lists_version}, Modloader, config::Cfg, input::{Input, ListOptions}, /*cmd_update,*/ error::{MLE, ErrorType, MLError}, /*modrinth::MCVersionType*/}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct List { @@ -9,20 +9,20 @@ pub struct List { pub modloader: Modloader, pub download_folder: String, } - +/* pub async fn list(config: Cfg, input: Input) -> Result<(), Box> { - match input.subcommand.ok_or("")? { - Subcmd::Add => { + match input.list_options.ok_or("")? { + ListOptions::Add => { match add(config, input.args.ok_or("")?) { Ok(..) => Ok(()), Err(e) => Err(Box::new(e)) } }, - Subcmd::Change => { + ListOptions::Change => { change(config, input.args) }, - Subcmd::Remove => { + ListOptions::Remove => { match remove(config, input.args.ok_or("")?) { Ok(..) => Ok(()), Err(e) => Err(Box::new(e)) @@ -39,7 +39,7 @@ pub async fn list(config: Cfg, input: Input) -> Result<(), Box MLE { let id = config_get_current_list(config.clone())?; lists_get(config, id) @@ -83,6 +83,7 @@ fn remove(config: Cfg, args: Vec) -> MLE<()> { } } +/* ///Changing the current lists version and updating it /// #Arguments /// @@ -95,3 +96,4 @@ async fn version(config: Cfg, args: Option>, version_type: Option