From d0d282de34e77263129770ab28b8ec97d115ba72 Mon Sep 17 00:00:00 2001 From: FxQnLr Date: Wed, 4 Jan 2023 13:41:27 +0100 Subject: started version implementation --- src/commands/list.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/commands') diff --git a/src/commands/list.rs b/src/commands/list.rs index bc9e67e..585efe2 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}, Modloader, config::Cfg, input::{Input, Subcmd}}; +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}}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct List { @@ -10,7 +10,7 @@ pub struct List { pub download_folder: String, } -pub fn list(config: Cfg, input: Input) -> Result<(), Box> { +pub async fn list(config: Cfg, input: Input) -> Result<(), Box> { match input.subcommand.ok_or("")? { Subcmd::Add => { @@ -22,6 +22,9 @@ pub fn list(config: Cfg, input: Input) -> Result<(), Box> Subcmd::Remove => { remove(config, input.args.ok_or("")?) }, + Subcmd::Version => { + version(config, input.args.ok_or("NO_VERSION")?) + } _ => { Err(Box::new(Error::new(ErrorKind::InvalidInput, "WRONG_SUBCOMMAND"))) } @@ -70,3 +73,8 @@ fn remove(config: Cfg, args: Vec) -> Result<(), Box panic!("list arguments should never be zero or lower"), } } + +fn version(config: Cfg, args: Vec) -> Result<(), Box> { + lists_version(config.clone(), config_get_current_list(config.clone())?, String::from(&args[0])) + //update the list & with -- args +} -- cgit v1.2.3