From 92bda65a9983e60036b3d49333e9bfe9bcd0543f Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Wed, 11 Jan 2023 17:21:08 +0100 Subject: begin of mc_version api impl --- src/commands/list.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/commands') diff --git a/src/commands/list.rs b/src/commands/list.rs index 526b434..a02f8b1 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}}; +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}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct List { @@ -26,7 +26,7 @@ pub async fn list(config: Cfg, input: Input) -> Result<(), Box { - match version(config, input.args.ok_or("NO_VERSION")?).await { + match version(config, Some(input.args.ok_or("NO_VERSION")?), Some(MCVersionType::Release)).await { Ok(..) => Ok(()), Err(e) => Err(Box::new(e)) } @@ -85,10 +85,10 @@ fn remove(config: Cfg, args: Vec) -> Result<(), Box) -> MLE<()> { +async fn version(config: Cfg, args: Option>, version_type: Option) -> MLE<()> { let current_list = lists_get(config.clone(), config_get_current_list(config.clone())?)?; - lists_version(config.clone(), String::from(¤t_list.id), String::from(&args[0]))?; + lists_version(config.clone(), String::from(¤t_list.id), String::from(&args.unwrap()[0]))?; //update the list & with -- args cmd_update(config, vec![current_list], true, true, false).await } -- cgit v1.2.3