diff options
Diffstat (limited to 'src/commands/update.rs')
-rw-r--r-- | src/commands/update.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/commands/update.rs b/src/commands/update.rs index 11f283e..ca28130 100644 --- a/src/commands/update.rs +++ b/src/commands/update.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | use std::io::{Error, ErrorKind}; | 1 | use std::io::{Error, ErrorKind}; |
2 | 2 | ||
3 | use crate::{config::Cfg, modrinth::{projects, Project, versions, extract_current_version, Version}, get_current_list, db::{userlist_get_all_ids, mods_get_versions, userlist_get_applicable_versions, userlist_change_versions, lists_get_all_ids, lists_get, userlist_get_current_version, mods_change_versions}, List, input::Input, files::{delete_version, download_versions, disable_version}}; | 3 | use crate::{config::Cfg, modrinth::{projects, Project, versions, extract_current_version, Version}, get_current_list, db::{userlist_get_all_ids, mods_get_versions, userlist_get_applicable_versions, userlist_change_versions, lists_get_all_ids, lists_get, userlist_get_current_version, mods_change_versions}, List, input::Input, files::{delete_version, download_versions, disable_version}, error::{MLE, MLError, ErrorType}}; |
4 | 4 | ||
5 | pub async fn update(config: Cfg, input: Input) -> Result<(), Box<dyn std::error::Error>> { | 5 | pub async fn update(config: Cfg, input: Input) -> MLE<()> { |
6 | 6 | ||
7 | let mut liststack: Vec<List> = vec![]; | 7 | let mut liststack: Vec<List> = vec![]; |
8 | if input.all_lists { | 8 | if input.all_lists { |
@@ -19,7 +19,7 @@ pub async fn update(config: Cfg, input: Input) -> Result<(), Box<dyn std::error: | |||
19 | cmd_update(config, liststack, input.clean, input.direct_download, input.delete_old).await | 19 | cmd_update(config, liststack, input.clean, input.direct_download, input.delete_old).await |
20 | } | 20 | } |
21 | 21 | ||
22 | pub async fn cmd_update(config: Cfg, liststack: Vec<List>, clean: bool, direct_download: bool, delete_old: bool) -> Result<(), Box<dyn std::error::Error>> { | 22 | pub async fn cmd_update(config: Cfg, liststack: Vec<List>, clean: bool, direct_download: bool, delete_old: bool) -> MLE<()> { |
23 | for current_list in liststack { | 23 | for current_list in liststack { |
24 | let mods = userlist_get_all_ids(config.clone(), current_list.clone().id)?; | 24 | let mods = userlist_get_all_ids(config.clone(), current_list.clone().id)?; |
25 | 25 | ||
@@ -37,7 +37,7 @@ pub async fn cmd_update(config: Cfg, liststack: Vec<List>, clean: bool, direct_d | |||
37 | let current_version = &versions[index]; | 37 | let current_version = &versions[index]; |
38 | let p_id = String::from(&project.id); | 38 | let p_id = String::from(&project.id); |
39 | let v_id = ¤t_version.mod_id; | 39 | let v_id = ¤t_version.mod_id; |
40 | if &p_id != v_id { return Err(Box::new(Error::new(ErrorKind::Other, "SORTING_ERROR"))) }; | 40 | if &p_id != v_id { return Err(MLError::new(ErrorType::Other, "SORTING_ERROR")) }; |
41 | 41 | ||
42 | //Getting current installed version for disable or delete | 42 | //Getting current installed version for disable or delete |
43 | let disable_version = userlist_get_current_version(config.clone(), String::from(¤t_list.id), String::from(&project.id))?; | 43 | let disable_version = userlist_get_current_version(config.clone(), String::from(¤t_list.id), String::from(&project.id))?; |