diff options
author | fxqnlr <[email protected]> | 2023-01-22 22:34:17 +0100 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-01-22 22:34:17 +0100 |
commit | 1890d59428dfcca861ea1b7820411d80cc60d713 (patch) | |
tree | 559a41a814a33a72ccab3640a6c81d10451f1683 /src/commands/download.rs | |
parent | f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537 (diff) | |
download | modlist-1890d59428dfcca861ea1b7820411d80cc60d713.tar modlist-1890d59428dfcca861ea1b7820411d80cc60d713.tar.gz modlist-1890d59428dfcca861ea1b7820411d80cc60d713.zip |
Added list version cmd, fixed some todos
Diffstat (limited to 'src/commands/download.rs')
-rw-r--r-- | src/commands/download.rs | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/commands/download.rs b/src/commands/download.rs index 0f63876..7748d15 100644 --- a/src/commands/download.rs +++ b/src/commands/download.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use crate::{files::{get_downloaded_versions, download_versions, delete_version, disable_version}, 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, input::Input}; |
3 | 3 | ||
4 | pub async fn download(config: Cfg, input: Input) -> MLE<()> { | 4 | pub async fn download(config: Cfg, input: Input) -> MLE<()> { |
@@ -44,17 +44,10 @@ pub async fn download(config: Cfg, input: Input) -> MLE<()> { | |||
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | if input.clean { | 47 | if input.clean { clean_list_dir(¤t_list)? }; |
48 | let dl_path = ¤t_list.download_folder; | ||
49 | println!("Cleaning {}", dl_path); | ||
50 | for entry in std::fs::read_dir(dl_path)? { | ||
51 | let entry = entry?; | ||
52 | std::fs::remove_file(entry.path())?; | ||
53 | } | ||
54 | } | ||
55 | 48 | ||
56 | if !to_download.is_empty() { | 49 | if !to_download.is_empty() { |
57 | download_versions(current_list.clone(), get_raw_versions(String::from(&config.apis.modrinth), to_download).await).await?; | 50 | download_versions(current_list.clone(), config.clone(), get_raw_versions(String::from(&config.apis.modrinth), to_download).await).await?; |
58 | } else { | 51 | } else { |
59 | println!("There are no new versions to download"); | 52 | println!("There are no new versions to download"); |
60 | } | 53 | } |