diff options
author | fxqnlr <[email protected]> | 2023-05-09 20:34:09 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-05-09 20:34:09 +0200 |
commit | 9063a041f6b2e72f6e4a861c77ac16065dd5378b (patch) | |
tree | 03d34dfe9ff05de2dd74d3afe1cde87712f1b59a /src/commands/download.rs | |
parent | 0c7ba29d3e17c47e5fc9cffe78c28a0019d453b7 (diff) | |
download | modlist-9063a041f6b2e72f6e4a861c77ac16065dd5378b.tar modlist-9063a041f6b2e72f6e4a861c77ac16065dd5378b.tar.gz modlist-9063a041f6b2e72f6e4a861c77ac16065dd5378b.zip |
add list toggles to update and download;
add mod remove output and fix errors
Diffstat (limited to 'src/commands/download.rs')
-rw-r--r-- | src/commands/download.rs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/commands/download.rs b/src/commands/download.rs index 1a8eb8f..ebfb4eb 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use crate::{config::Cfg, get_current_list, List}; | 1 | use crate::{config::Cfg, List}; |
2 | use crate::{ | 2 | use crate::{ |
3 | db::{lists_get, lists_get_all_ids, userlist_get_all_current_versions_with_mods}, | 3 | db::userlist_get_all_current_versions_with_mods, |
4 | error::{ErrorType, MLError, MLE}, | 4 | error::{ErrorType, MLError, MLE}, |
5 | files::{ | 5 | files::{ |
6 | clean_list_dir, delete_version, disable_version, download_versions, get_downloaded_versions, | 6 | clean_list_dir, delete_version, disable_version, download_versions, get_downloaded_versions, |
@@ -8,20 +8,10 @@ use crate::{ | |||
8 | modrinth::get_raw_versions, | 8 | modrinth::get_raw_versions, |
9 | }; | 9 | }; |
10 | 10 | ||
11 | pub async fn download(config: Cfg, all_lists: bool, clean: bool, delete_old: bool) -> MLE<()> { | 11 | pub async fn download(config: Cfg, liststack: Vec<List>, clean: bool, delete_old: bool) -> MLE<()> { |
12 | let mut liststack: Vec<List> = vec![]; | ||
13 | if all_lists { | ||
14 | let list_ids = lists_get_all_ids(config.clone())?; | ||
15 | for id in list_ids { | ||
16 | liststack.push(lists_get(config.clone(), id)?); | ||
17 | } | ||
18 | } else { | ||
19 | let current = get_current_list(config.clone())?; | ||
20 | println!("Downloading current versions of mods in {}", current.id); | ||
21 | liststack.push(current) | ||
22 | } | ||
23 | 12 | ||
24 | for current_list in liststack { | 13 | for current_list in liststack { |
14 | println!("Downloading current versions of mods in {}", current_list.id); | ||
25 | let downloaded_versions = get_downloaded_versions(current_list.clone())?; | 15 | let downloaded_versions = get_downloaded_versions(current_list.clone())?; |
26 | // println!("To download: {:#?}", downloaded_versions); | 16 | // println!("To download: {:#?}", downloaded_versions); |
27 | let current_version_ids = match userlist_get_all_current_versions_with_mods( | 17 | let current_version_ids = match userlist_get_all_current_versions_with_mods( |