diff options
Diffstat (limited to 'src/commands/download.rs')
-rw-r--r-- | src/commands/download.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/commands/download.rs b/src/commands/download.rs index 2714630..4baecee 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs | |||
@@ -1,10 +1,10 @@ | |||
1 | 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}}; | 1 | 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}}; |
2 | use crate::{List, get_current_list, config::Cfg, input::Input}; | 2 | use crate::{List, get_current_list, config::Cfg}; |
3 | 3 | ||
4 | pub async fn download(config: Cfg, input: Input) -> MLE<()> { | 4 | pub async fn download(config: Cfg, all_lists: bool, clean: bool, delete_old: bool) -> MLE<()> { |
5 | 5 | ||
6 | let mut liststack: Vec<List> = vec![]; | 6 | let mut liststack: Vec<List> = vec![]; |
7 | if input.all_lists { | 7 | if all_lists { |
8 | let list_ids = lists_get_all_ids(config.clone())?; | 8 | let list_ids = lists_get_all_ids(config.clone())?; |
9 | for id in list_ids { | 9 | for id in list_ids { |
10 | liststack.push(lists_get(config.clone(), id)?); | 10 | liststack.push(lists_get(config.clone(), id)?); |
@@ -33,7 +33,7 @@ pub async fn download(config: Cfg, input: Input) -> MLE<()> { | |||
33 | 33 | ||
34 | let current_download = downloaded_versions.get(&mod_id); | 34 | let current_download = downloaded_versions.get(&mod_id); |
35 | 35 | ||
36 | if current_download.is_none() || input.clean { | 36 | if current_download.is_none() || clean { |
37 | to_download.push(current_version); | 37 | to_download.push(current_version); |
38 | } else { | 38 | } else { |
39 | let downloaded_version = current_download.ok_or("SOMETHING_HAS_REALLY_GONE_WRONG").unwrap(); | 39 | let downloaded_version = current_download.ok_or("SOMETHING_HAS_REALLY_GONE_WRONG").unwrap(); |
@@ -44,7 +44,7 @@ pub async fn download(config: Cfg, input: Input) -> MLE<()> { | |||
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | if input.clean { clean_list_dir(¤t_list)? }; | 47 | if clean { clean_list_dir(¤t_list)? }; |
48 | 48 | ||
49 | if !to_download.is_empty() { | 49 | if !to_download.is_empty() { |
50 | download_versions(current_list.clone(), config.clone(), get_raw_versions(&config.apis.modrinth, to_download).await).await?; | 50 | download_versions(current_list.clone(), config.clone(), get_raw_versions(&config.apis.modrinth, to_download).await).await?; |
@@ -54,7 +54,7 @@ pub async fn download(config: Cfg, input: Input) -> MLE<()> { | |||
54 | 54 | ||
55 | if !to_disable.is_empty() { | 55 | if !to_disable.is_empty() { |
56 | for ver in to_disable { | 56 | for ver in to_disable { |
57 | if input.delete_old { | 57 | if delete_old { |
58 | println!("Deleting version {} for mod {}", ver.1, ver.0); | 58 | println!("Deleting version {} for mod {}", ver.1, ver.0); |
59 | delete_version(current_list.clone(), ver.1)?; | 59 | delete_version(current_list.clone(), ver.1)?; |
60 | } else { | 60 | } else { |