From 8050cfcd70a16273cc2814fe29c8ee08320d85d3 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 20 Apr 2023 15:13:58 +0200 Subject: cargo fmt --- src/commands/download.rs | 38 ++++++--- src/commands/io.rs | 51 ++++++++---- src/commands/list.rs | 38 +++++++-- src/commands/mod.rs | 16 ++-- src/commands/modification.rs | 181 +++++++++++++++++++++++++++++++++---------- src/commands/setup.rs | 12 ++- src/commands/update.rs | 116 ++++++++++++++++++++------- 7 files changed, 338 insertions(+), 114 deletions(-) (limited to 'src/commands') diff --git a/src/commands/download.rs b/src/commands/download.rs index 4baecee..9434591 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs @@ -1,8 +1,14 @@ -use crate::{files::{get_downloaded_versions, download_versions, delete_version, disable_version, clean_list_dir}, db::{userlist_get_all_current_versions_with_mods, lists_get_all_ids, lists_get}, modrinth::get_raw_versions, error::{MLE, ErrorType, MLError}}; -use crate::{List, get_current_list, config::Cfg}; +use crate::{config::Cfg, get_current_list, List}; +use crate::{ + db::{lists_get, lists_get_all_ids, userlist_get_all_current_versions_with_mods}, + error::{ErrorType, MLError, MLE}, + files::{ + clean_list_dir, delete_version, disable_version, download_versions, get_downloaded_versions, + }, + modrinth::get_raw_versions, +}; pub async fn download(config: Cfg, all_lists: bool, clean: bool, delete_old: bool) -> MLE<()> { - let mut liststack: Vec = vec![]; if all_lists { let list_ids = lists_get_all_ids(config.clone())?; @@ -18,7 +24,10 @@ pub async fn download(config: Cfg, all_lists: bool, clean: bool, delete_old: boo for current_list in liststack { let downloaded_versions = get_downloaded_versions(current_list.clone())?; println!("To download: {:#?}", downloaded_versions); - let current_version_ids = match userlist_get_all_current_versions_with_mods(config.clone(), String::from(¤t_list.id)) { + let current_version_ids = match userlist_get_all_current_versions_with_mods( + config.clone(), + String::from(¤t_list.id), + ) { Ok(i) => Ok(i), Err(e) => Err(MLError::new(ErrorType::DBError, e.to_string().as_str())), }?; @@ -36,28 +45,37 @@ pub async fn download(config: Cfg, all_lists: bool, clean: bool, delete_old: boo if current_download.is_none() || clean { to_download.push(current_version); } else { - let downloaded_version = current_download.ok_or("SOMETHING_HAS_REALLY_GONE_WRONG").unwrap(); + let downloaded_version = current_download + .ok_or("SOMETHING_HAS_REALLY_GONE_WRONG") + .unwrap(); if ¤t_version != downloaded_version { to_disable.push((mod_id.clone(), String::from(downloaded_version))); to_download.push(current_version); } } } - - if clean { clean_list_dir(¤t_list)? }; + + if clean { + clean_list_dir(¤t_list)? + }; if !to_download.is_empty() { - download_versions(current_list.clone(), config.clone(), get_raw_versions(&config.apis.modrinth, to_download).await).await?; + download_versions( + current_list.clone(), + config.clone(), + get_raw_versions(&config.apis.modrinth, to_download).await, + ) + .await?; } else { println!("There are no new versions to download"); } - + if !to_disable.is_empty() { for ver in to_disable { if delete_old { println!("Deleting version {} for mod {}", ver.1, ver.0); delete_version(current_list.clone(), ver.1)?; - } else { + } else { disable_version(config.clone(), current_list.clone(), ver.1, ver.0)?; }; } diff --git a/src/commands/io.rs b/src/commands/io.rs index 5de8dd1..7f03eec 100644 --- a/src/commands/io.rs +++ b/src/commands/io.rs @@ -1,12 +1,18 @@ +use serde::{Deserialize, Serialize}; use std::fs::File; use std::io::prelude::*; -use serde::{Serialize, Deserialize}; -use crate::{db::{lists_get, userlist_get_all_ids, lists_get_all_ids, lists_insert}, config::Cfg, Modloader, List, devdir, error::MLE, mod_add, IDSelector}; +use crate::{ + config::Cfg, + db::{lists_get, lists_get_all_ids, lists_insert, userlist_get_all_ids}, + devdir, + error::MLE, + mod_add, IDSelector, List, Modloader, +}; #[derive(Debug, Serialize, Deserialize)] struct Export { - lists: Vec + lists: Vec, } #[derive(Debug, Serialize, Deserialize)] @@ -20,15 +26,22 @@ struct ExportList { impl ExportList { pub fn from(config: Cfg, list_id: String, download: bool) -> MLE { - let list = lists_get(config.clone(), String::from(&list_id))?; let mut dl_folder = None; - if download{ dl_folder = Some(list.download_folder) }; + if download { + dl_folder = Some(list.download_folder) + }; let mods = userlist_get_all_ids(config, list_id)?.join("|"); - Ok(Self { id: list.id, mods, launcher: list.modloader.to_string(), mc_version: list.mc_version, download_folder: dl_folder }) + Ok(Self { + id: list.id, + mods, + launcher: list.modloader.to_string(), + mc_version: list.mc_version, + download_folder: dl_folder, + }) } } @@ -43,32 +56,44 @@ pub fn export(config: Cfg, list: Option) -> MLE<()> { for list_id in list_ids { lists.push(ExportList::from(config.clone(), list_id, true)?); } - - let toml = toml::to_string( &Export { lists } )?; + + let toml = toml::to_string(&Export { lists })?; let filestr = dirs::home_dir().unwrap().join("mlexport.toml"); - let mut file = File::create(devdir(filestr.into_os_string().into_string().unwrap().as_str()))?; + let mut file = File::create(devdir( + filestr.into_os_string().into_string().unwrap().as_str(), + ))?; file.write_all(toml.as_bytes())?; Ok(()) } pub async fn import(config: Cfg, file_str: String, direct_download: bool) -> MLE<()> { - let mut file = File::open(file_str)?; let mut content = String::new(); file.read_to_string(&mut content)?; let export: Export = toml::from_str(&content)?; for exportlist in export.lists { - let list = List { id: exportlist.id, mc_version: exportlist.mc_version, modloader: Modloader::from(&exportlist.launcher)?, download_folder: exportlist.download_folder.ok_or("NO_DL").unwrap() }; - lists_insert(config.clone(), list.id.clone(), list.mc_version.clone(), list.modloader.clone(), String::from(&list.download_folder))?; + let list = List { + id: exportlist.id, + mc_version: exportlist.mc_version, + modloader: Modloader::from(&exportlist.launcher)?, + download_folder: exportlist.download_folder.ok_or("NO_DL").unwrap(), + }; + lists_insert( + config.clone(), + list.id.clone(), + list.mc_version.clone(), + list.modloader.clone(), + String::from(&list.download_folder), + )?; let mods: Vec<&str> = exportlist.mods.split('|').collect(); let mut mod_ids = vec![]; for mod_id in mods { mod_ids.push(IDSelector::ModificationID(String::from(mod_id))); - }; + } //TODO impl set_version and good direct download //TODO impl all at once, dafuck mod_add(config.clone(), mod_ids, list, direct_download, false).await?; diff --git a/src/commands/list.rs b/src/commands/list.rs index 80e801a..13176f4 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -1,4 +1,12 @@ -use crate::{db::{lists_insert, lists_remove, config_change_current_list, config_get_current_list, lists_get, lists_version}, Modloader, config::Cfg, update, error::MLE}; +use crate::{ + config::Cfg, + db::{ + config_change_current_list, config_get_current_list, lists_get, lists_insert, lists_remove, + lists_version, + }, + error::MLE, + update, Modloader, +}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct List { @@ -13,7 +21,13 @@ pub fn get_current_list(config: Cfg) -> MLE { lists_get(config, id) } -pub fn list_add(config: Cfg, id: String, mc_version: String, modloader: Modloader, directory: String) -> MLE<()> { +pub fn list_add( + config: Cfg, + id: String, + mc_version: String, + modloader: Modloader, + directory: String, +) -> MLE<()> { lists_insert(config, id, mc_version, modloader, directory) } @@ -30,15 +44,27 @@ pub fn list_remove(config: Cfg, id: String) -> MLE<()> { ///Changing the current lists version and updating it /// /// #Arguments -/// +/// /// * `config` - The current config /// * `args` - All args, to extract the new version -pub async fn list_version(config: Cfg, id: String, mc_version: String, download: bool, delete: bool) -> MLE<()> { - println!("Change version for list {} to minecraft version: {}", id, mc_version); +pub async fn list_version( + config: Cfg, + id: String, + mc_version: String, + download: bool, + delete: bool, +) -> MLE<()> { + println!( + "Change version for list {} to minecraft version: {}", + id, mc_version + ); lists_version(config.clone(), &id, &mc_version)?; - println!("\nCheck for updates for new minecraft version in list {}", id); + println!( + "\nCheck for updates for new minecraft version in list {}", + id + ); let list = lists_get(config.clone(), id)?; update(config, vec![list], true, download, delete).await } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 0d5bd00..1c7c012 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,13 +1,13 @@ -pub mod modification; -pub mod list; -pub mod update; -pub mod setup; pub mod download; pub mod io; +pub mod list; +pub mod modification; +pub mod setup; +pub mod update; -pub use modification::*; -pub use list::*; -pub use update::*; -pub use setup::*; pub use download::*; pub use io::*; +pub use list::*; +pub use modification::*; +pub use setup::*; +pub use update::*; diff --git a/src/commands/modification.rs b/src/commands/modification.rs index 454e148..ffc4e10 100644 --- a/src/commands/modification.rs +++ b/src/commands/modification.rs @@ -1,9 +1,19 @@ -use crate::{modrinth::{versions, extract_current_version, Version, projects, get_raw_versions, project}, config::Cfg, db::{mods_insert, userlist_remove, mods_get_id, userlist_insert, userlist_get_all_ids, userlist_get_current_version, lists_get_all_ids, mods_remove}, files::{delete_version, download_versions}, List, error::{MLE, ErrorType, MLError}}; +use crate::{ + config::Cfg, + db::{ + lists_get_all_ids, mods_get_id, mods_insert, mods_remove, userlist_get_all_ids, + userlist_get_current_version, userlist_insert, userlist_remove, + }, + error::{ErrorType, MLError, MLE}, + files::{delete_version, download_versions}, + modrinth::{extract_current_version, get_raw_versions, project, projects, versions, Version}, + List, +}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum IDSelector { ModificationID(String), - VersionID(String) + VersionID(String), } #[derive(Debug, Clone)] @@ -16,10 +26,16 @@ pub struct ProjectInfo { pub download_link: String, } -pub async fn mod_add(config: Cfg, ids: Vec, list: List, direct_download: bool, set_version: bool) -> MLE<()> { +pub async fn mod_add( + config: Cfg, + ids: Vec, + list: List, + direct_download: bool, + set_version: bool, +) -> MLE<()> { println!("Add mods to {}", list.id); println!(" └Add mods:"); - + let mut mod_ids: Vec = Vec::new(); let mut ver_ids: Vec = Vec::new(); @@ -32,11 +48,17 @@ pub async fn mod_add(config: Cfg, ids: Vec, list: List, direct_downl } let mut projectinfo: Vec = Vec::new(); - if !mod_ids.is_empty() { projectinfo.append(&mut get_mod_infos(config.clone(), mod_ids, list.clone()).await?) }; - if !ver_ids.is_empty() { projectinfo.append(&mut get_ver_info(config.clone(), ver_ids).await?) }; + if !mod_ids.is_empty() { + projectinfo.append(&mut get_mod_infos(config.clone(), mod_ids, list.clone()).await?) + }; + if !ver_ids.is_empty() { + projectinfo.append(&mut get_ver_info(config.clone(), ver_ids).await?) + }; + + if projectinfo.is_empty() { + return Err(MLError::new(ErrorType::ArgumentError, "NO_IDS?")); + }; - if projectinfo.is_empty() { return Err(MLError::new(ErrorType::ArgumentError, "NO_IDS?")) }; - let mut downloadstack: Vec = Vec::new(); //Adding each mod to the lists and downloadstack @@ -45,29 +67,59 @@ pub async fn mod_add(config: Cfg, ids: Vec, list: List, direct_downl } else { println!(" └Insert mods in list {} and save infos", list.id); } - + for project in projectinfo { - let current_version_id = if project.current_version.is_none() { String::from("NONE") } else { project.current_version.clone().unwrap().id }; - match userlist_insert(config.clone(), &list.id, &project.mod_id, ¤t_version_id, project.clone().applicable_versions, &project.download_link, set_version) { + let current_version_id = if project.current_version.is_none() { + String::from("NONE") + } else { + project.current_version.clone().unwrap().id + }; + match userlist_insert( + config.clone(), + &list.id, + &project.mod_id, + ¤t_version_id, + project.clone().applicable_versions, + &project.download_link, + set_version, + ) { Err(e) => { let expected_err = format!("SQL: UNIQUE constraint failed: {}.mod_id", list.id); - if e.to_string() == expected_err { Err(MLError::new(ErrorType::ModError, "MOD_ALREADY_ON_SELECTED_LIST")) } else { Err(e) } - }, - Ok(..) => { Ok(..) }, + if e.to_string() == expected_err { + Err(MLError::new( + ErrorType::ModError, + "MOD_ALREADY_ON_SELECTED_LIST", + )) + } else { + Err(e) + } + } + Ok(..) => Ok(..), }?; - - match mods_insert(config.clone(), &project.mod_id, &project.slug, &project.title) { + + match mods_insert( + config.clone(), + &project.mod_id, + &project.slug, + &project.title, + ) { Err(e) => { - if e.to_string() == "SQL: UNIQUE constraint failed: mods.id" { Ok(..) } else { Err(e) } - }, + if e.to_string() == "SQL: UNIQUE constraint failed: mods.id" { + Ok(..) + } else { + Err(e) + } + } Ok(..) => Ok(..), }?; - if project.current_version.is_some() { downloadstack.push(project.current_version.unwrap()) }; + if project.current_version.is_some() { + downloadstack.push(project.current_version.unwrap()) + }; } //Download all the added mods - if direct_download { + if direct_download { download_versions(list.clone(), config.clone(), downloadstack).await?; }; @@ -86,7 +138,12 @@ async fn get_mod_infos(config: Cfg, mod_ids: Vec, list: List) -> MLE = Vec::new(); let current_version: Option; @@ -95,36 +152,63 @@ async fn get_mod_infos(config: Cfg, mod_ids: Vec, list: List) -> MLE) -> MLE> { let mut projectinfo: Vec = Vec::new(); - + //Get required information from ver_ids let mut v_versions = get_raw_versions(&config.apis.modrinth, ver_ids).await; let mut v_mod_ids: Vec = Vec::new(); for ver in v_versions.clone() { v_mod_ids.push(ver.project_id); - }; + } let mut v_projects = projects(&config.apis.modrinth, v_mod_ids).await; v_versions.sort_by(|a, b| a.project_id.cmp(&b.project_id)); v_projects.sort_by(|a, b| a.id.cmp(&b.id)); @@ -132,9 +216,22 @@ async fn get_ver_info(config: Cfg, ver_ids: Vec) -> MLE for (i, project) in v_projects.into_iter().enumerate() { let version = &v_versions[i]; println!("\t└{}({})", project.title, version.id); - let file = version.clone().files.into_iter().find(|f| f.primary).unwrap().url; - projectinfo.push(ProjectInfo { mod_id: project.id, slug: project.slug, title: project.title, current_version: Some(version.clone()), applicable_versions: vec![String::from(&version.id)], download_link: file }) - }; + let file = version + .clone() + .files + .into_iter() + .find(|f| f.primary) + .unwrap() + .url; + projectinfo.push(ProjectInfo { + mod_id: project.id, + slug: project.slug, + title: project.title, + current_version: Some(version.clone()), + applicable_versions: vec![String::from(&version.id)], + download_link: file, + }) + } Ok(projectinfo) } @@ -145,24 +242,28 @@ async fn get_ver_info(config: Cfg, ver_ids: Vec) -> MLE /// * `id` - name, slug or id of the mod /// * `list` - List struct pub fn mod_remove(config: Cfg, id: &str, list: List) -> MLE<()> { - let mod_id = mods_get_id(&config.data, id)?; - + let version = userlist_get_current_version(config.clone(), &list.id, &mod_id)?; userlist_remove(config.clone(), &list.id, &mod_id)?; delete_version(list, version)?; - + let list_ids = lists_get_all_ids(config.clone())?; - + // Remove mod from main list if not used elsewhere let mut mod_used = false; for id in list_ids { let mods = userlist_get_all_ids(config.clone(), id)?; - if mods.contains(&mod_id) { mod_used = true; break; }; - }; + if mods.contains(&mod_id) { + mod_used = true; + break; + }; + } - if !mod_used { mods_remove(config, mod_id)?; }; + if !mod_used { + mods_remove(config, mod_id)?; + }; Ok(()) } diff --git a/src/commands/setup.rs b/src/commands/setup.rs index 0161bd7..40e8c0a 100644 --- a/src/commands/setup.rs +++ b/src/commands/setup.rs @@ -1,14 +1,14 @@ use std::{fs::File, path::Path}; -use crate::{config::Cfg, db::db_setup, error::MLE, devdir}; +use crate::{config::Cfg, db::db_setup, devdir, error::MLE}; pub async fn setup(config: Cfg) -> MLE<()> { let db_file = devdir(format!("{}/data.db", config.data).as_str()); - + if !Path::new(&db_file).exists() { create(config, db_file)?; } - + /* match s_config_get_version(config.clone()) { Ok(ver) => { @@ -21,12 +21,11 @@ pub async fn setup(config: Cfg) -> MLE<()> { Err(..) => to_02(config).await? }; */ - + Ok(()) } fn create(config: Cfg, db_file: String) -> MLE<()> { - println!("Create database"); File::create(db_file)?; @@ -44,7 +43,7 @@ fn create(config: Cfg, db_file: String) -> MLE<()> { // let full_list = lists_get(config.clone(), String::from(&list))?; // // let versions = userlist_get_all_current_version_ids(config.clone(), full_list.clone().id)?; -// +// // let raw_versions = get_raw_versions(String::from(&config.apis.modrinth), versions).await; // // for ver in raw_versions { @@ -69,4 +68,3 @@ fn create(config: Cfg, db_file: String) -> MLE<()> { // } // s_config_update_version(config, String::from("0.4")) //} - diff --git a/src/commands/update.rs b/src/commands/update.rs index e5751c0..3d9578b 100644 --- a/src/commands/update.rs +++ b/src/commands/update.rs @@ -1,14 +1,30 @@ -use crate::{config::Cfg, modrinth::{versions, extract_current_version, Version}, db::{userlist_get_all_ids, userlist_get_applicable_versions, userlist_change_versions, userlist_get_current_version, userlist_get_set_version, mods_get_info}, List, files::{delete_version, download_versions, disable_version, clean_list_dir}, error::{MLE, MLError, ErrorType}}; - -pub async fn update(config: Cfg, liststack: Vec, clean: bool, direct_download: bool, delete_old: bool) -> MLE<()> { +use crate::{ + config::Cfg, + db::{ + mods_get_info, userlist_change_versions, userlist_get_all_ids, + userlist_get_applicable_versions, userlist_get_current_version, userlist_get_set_version, + }, + error::{ErrorType, MLError, MLE}, + files::{clean_list_dir, delete_version, disable_version, download_versions}, + modrinth::{extract_current_version, versions, Version}, + List, +}; + +pub async fn update( + config: Cfg, + liststack: Vec, + clean: bool, + direct_download: bool, + delete_old: bool, +) -> MLE<()> { for current_list in liststack { let mods = userlist_get_all_ids(config.clone(), current_list.clone().id)?; - + let mut current_versions: Vec<(String, String)> = vec![]; - + println!(" └Update mods:"); let mut updatestack: Vec = vec![]; - + for id in mods { let info = mods_get_info(config.clone(), &id)?; println!("\t└{}", info.title); @@ -19,27 +35,39 @@ pub async fn update(config: Cfg, liststack: Vec, clean: bool, direct_downl } //Getting current installed version for disable or delete - let disable_version = userlist_get_current_version(config.clone(), ¤t_list.id, &id)?; + let disable_version = + userlist_get_current_version(config.clone(), ¤t_list.id, &id)?; updatestack.push( - match specific_update(config.clone(), clean, current_list.clone(), String::from(&id)).await { + match specific_update( + config.clone(), + clean, + current_list.clone(), + String::from(&id), + ) + .await + { Ok(ver) => { current_versions.push((disable_version, id)); ver - }, + } Err(e) => { if e.to_string() == "Mod: NO_UPDATE_AVAILABLE" { - println!("\t └No new version found for the specified minecraft version"); + println!( + "\t └No new version found for the specified minecraft version" + ); } else { return Err(e); }; continue; } - } + }, ) - }; + } - if clean { clean_list_dir(¤t_list)?; }; + if clean { + clean_list_dir(¤t_list)?; + }; if direct_download && !updatestack.is_empty() { download_versions(current_list.clone(), config.clone(), updatestack).await?; @@ -50,7 +78,7 @@ pub async fn update(config: Cfg, liststack: Vec, clean: bool, direct_downl if delete_old { println!("\t └Delete version {}", ver.0); delete_version(current_list.clone(), ver.0)?; - } else if ver.0 != "NONE" { + } else if ver.0 != "NONE" { println!("\t └Disable version {}", ver.0); disable_version(config.clone(), current_list.clone(), ver.0, ver.1)?; }; @@ -63,10 +91,11 @@ pub async fn update(config: Cfg, liststack: Vec, clean: bool, direct_downl } async fn specific_update(config: Cfg, clean: bool, list: List, id: String) -> MLE { - let applicable_versions = versions(&config.apis.modrinth, String::from(&id), list.clone()).await; - + let applicable_versions = + versions(&config.apis.modrinth, String::from(&id), list.clone()).await; + let mut versions: Vec = vec![]; - + if !applicable_versions.is_empty() { for ver in &applicable_versions { versions.push(String::from(&ver.id)); @@ -77,8 +106,14 @@ async fn specific_update(config: Cfg, clean: bool, list: List, id: String) -> ML let mut current: Vec = vec![]; //TODO Split clean and no match - if clean || (versions.join("|") != userlist_get_applicable_versions(config.clone(), String::from(&list.id), String::from(&id))?) { - + if clean + || (versions.join("|") + != userlist_get_applicable_versions( + config.clone(), + String::from(&list.id), + String::from(&id), + )?) + { let current_str = extract_current_version(applicable_versions.clone())?; if clean { @@ -89,35 +124,54 @@ async fn specific_update(config: Cfg, clean: bool, list: List, id: String) -> ML }; //get new versions - let current_ver = match applicable_versions.into_iter().find(|ver| ver.id == current_str).ok_or("!no current version in applicable_versions") { + let current_ver = match applicable_versions + .into_iter() + .find(|ver| ver.id == current_str) + .ok_or("!no current version in applicable_versions") + { Ok(v) => Ok(v), Err(e) => Err(MLError::new(ErrorType::Other, e)), }?; current.push(current_ver.clone()); //TODO implement version selection if no primary - let link = match current_ver.files.into_iter().find(|f| f.primary).ok_or("!no primary in links") { + let link = match current_ver + .files + .into_iter() + .find(|f| f.primary) + .ok_or("!no primary in links") + { Ok(p) => Ok(p), Err(e) => Err(MLError::new(ErrorType::Other, e)), - }?.url; + }? + .url; userlist_change_versions(config, list.id, current_str, versions.join("|"), link, id)?; } - if current.is_empty() { return Err(MLError::new(ErrorType::ModError, "NO_UPDATE_AVAILABLE")) }; - + if current.is_empty() { + return Err(MLError::new(ErrorType::ModError, "NO_UPDATE_AVAILABLE")); + }; + //println!(" └✔️"); Ok(current[0].clone()) } #[tokio::test] async fn download_updates_test() { + use crate::{ + modrinth::{Hash, Version, VersionFile, VersionType}, + List, Modloader, + }; - use crate::{modrinth::{Version, VersionFile, Hash, VersionType}, Modloader, List}; - let config = Cfg::init("modlist.toml").unwrap(); - let current_list = List { id: String::from("..."), mc_version: String::from("..."), modloader: Modloader::Fabric, download_folder: String::from("./dev/tests/dl") }; - - let versions = vec![Version { + let current_list = List { + id: String::from("..."), + mc_version: String::from("..."), + modloader: Modloader::Fabric, + download_folder: String::from("./dev/tests/dl"), + }; + + let versions = vec![Version { id: "dEqtGnT9".to_string(), project_id: "kYuIpRLv".to_string(), author_id: "Qnt13hO8".to_string(), @@ -147,5 +201,7 @@ async fn download_updates_test() { "fabric".to_string() ] }]; - assert!(download_versions(current_list, config, versions).await.is_ok()) + assert!(download_versions(current_list, config, versions) + .await + .is_ok()) } -- cgit v1.2.3