diff options
author | FxQnLr <[email protected]> | 2023-01-29 14:13:06 +0100 |
---|---|---|
committer | FxQnLr <[email protected]> | 2023-01-29 14:13:06 +0100 |
commit | d7d0c904bff665ab5c8355f2381a0628ebbf7a30 (patch) | |
tree | 68a63f39a5bf6241e4ca9499d03ea148ec9737c4 | |
parent | c51647f527b43e7109d6922e07c6c1daa5501819 (diff) | |
parent | 54752f7eb39e20929a7816c90be33bf8dbff2a6c (diff) | |
download | modlist-d7d0c904bff665ab5c8355f2381a0628ebbf7a30.tar modlist-d7d0c904bff665ab5c8355f2381a0628ebbf7a30.tar.gz modlist-d7d0c904bff665ab5c8355f2381a0628ebbf7a30.zip |
Merge branch 'new_input' of https://github.com/FxQnLr/modlist into new_input
-rw-r--r-- | src/commands/modification.rs | 4 | ||||
-rw-r--r-- | src/commands/update.rs | 3 | ||||
-rw-r--r-- | src/files.rs | 3 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/commands/modification.rs b/src/commands/modification.rs index c194202..c82d6b5 100644 --- a/src/commands/modification.rs +++ b/src/commands/modification.rs | |||
@@ -18,7 +18,7 @@ async fn add(config: Cfg, input: Input) -> MLE<()> { | |||
18 | Ok(()) | 18 | Ok(()) |
19 | } | 19 | } |
20 | 20 | ||
21 | pub async fn mod_add(config: Cfg, mod_id: Vec<String>, list: List, disable_download: bool) -> MLE<()> { | 21 | pub async fn mod_add(config: Cfg, mod_id: Vec<String>, list: List, direct_download: bool) -> MLE<()> { |
22 | 22 | ||
23 | //Fix printing (its horrible) | 23 | //Fix printing (its horrible) |
24 | println!("Adding mod(s) {:?}", mod_id); | 24 | println!("Adding mod(s) {:?}", mod_id); |
@@ -80,7 +80,7 @@ pub async fn mod_add(config: Cfg, mod_id: Vec<String>, list: List, disable_downl | |||
80 | }, | 80 | }, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | if !disable_download && current_version.is_some() { download_versions(list.clone(), config.clone(), vec![current_version.unwrap()]).await?; }; | 83 | if direct_download && current_version.is_some() { download_versions(list.clone(), config.clone(), vec![current_version.unwrap()]).await?; }; |
84 | 84 | ||
85 | } | 85 | } |
86 | 86 | ||
diff --git a/src/commands/update.rs b/src/commands/update.rs index f71f537..d400a24 100644 --- a/src/commands/update.rs +++ b/src/commands/update.rs | |||
@@ -74,7 +74,7 @@ pub async fn cmd_update(config: Cfg, liststack: Vec<List>, clean: bool, direct_d | |||
74 | //Linebreak readability | 74 | //Linebreak readability |
75 | println!(""); | 75 | println!(""); |
76 | 76 | ||
77 | if direct_download { | 77 | if direct_download && !updatestack.is_empty() { |
78 | download_versions(current_list.clone(), config.clone(), updatestack).await?; | 78 | download_versions(current_list.clone(), config.clone(), updatestack).await?; |
79 | 79 | ||
80 | //Disable old versions | 80 | //Disable old versions |
@@ -90,7 +90,6 @@ pub async fn cmd_update(config: Cfg, liststack: Vec<List>, clean: bool, direct_d | |||
90 | } | 90 | } |
91 | } | 91 | } |
92 | }; | 92 | }; |
93 | |||
94 | } | 93 | } |
95 | 94 | ||
96 | Ok(()) | 95 | Ok(()) |
diff --git a/src/files.rs b/src/files.rs index ecb6e3e..8c822b2 100644 --- a/src/files.rs +++ b/src/files.rs | |||
@@ -13,6 +13,7 @@ pub async fn download_versions(list: List, config: Cfg, versions: Vec<Version>) | |||
13 | for ver in versions { | 13 | for ver in versions { |
14 | let project_name = mods_get_name(config.clone(), &ver.project_id)?; | 14 | let project_name = mods_get_name(config.clone(), &ver.project_id)?; |
15 | print!("\t({})Download version {}", project_name, ver.id); | 15 | print!("\t({})Download version {}", project_name, ver.id); |
16 | //Force flush of stdout, else print! doesn't print instantly | ||
16 | std::io::stdout().flush().unwrap(); | 17 | std::io::stdout().flush().unwrap(); |
17 | let primary_file = ver.files.into_iter().find(|file| file.primary).unwrap(); | 18 | let primary_file = ver.files.into_iter().find(|file| file.primary).unwrap(); |
18 | let mut splitname: Vec<&str> = primary_file.filename.split('.').collect(); | 19 | let mut splitname: Vec<&str> = primary_file.filename.split('.').collect(); |
@@ -22,7 +23,7 @@ pub async fn download_versions(list: List, config: Cfg, versions: Vec<Version>) | |||
22 | }; | 23 | }; |
23 | let filename = format!("{}.mr.{}.{}.{}", splitname.join("."), ver.project_id, ver.id, extension); | 24 | let filename = format!("{}.mr.{}.{}.{}", splitname.join("."), ver.project_id, ver.id, extension); |
24 | download_file(primary_file.url, list.clone().download_folder, filename).await?; | 25 | download_file(primary_file.url, list.clone().download_folder, filename).await?; |
25 | tokio::time::sleep(std::time::Duration::new(3, 0)).await; | 26 | //tokio::time::sleep(std::time::Duration::new(3, 0)).await; |
26 | println!(" ✓"); | 27 | println!(" ✓"); |
27 | } | 28 | } |
28 | 29 | ||