summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-05-25 22:48:54 +0200
committerfxqnlr <[email protected]>2023-05-25 22:48:54 +0200
commitd8554e30029bf43dccce72e982784cd01857b0c4 (patch)
tree72b4ee26a4f980deb1165e615e47598be017e5fa /src/lib.rs
parent7f1a262999d7a8b7f12a97daf4b6722638dc62a1 (diff)
downloadmodlist-d8554e30029bf43dccce72e982784cd01857b0c4.tar
modlist-d8554e30029bf43dccce72e982784cd01857b0c4.tar.gz
modlist-d8554e30029bf43dccce72e982784cd01857b0c4.zip
added mod add progress
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index a7a34ac..7287660 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,9 +15,10 @@ use error::{ErrorType, MLError, MLE};
15use indicatif::{ProgressStyle, ProgressBar}; 15use indicatif::{ProgressStyle, ProgressBar};
16use serde::{Deserialize, Serialize}; 16use serde::{Deserialize, Serialize};
17 17
18pub static STYLE_BAR_POS: &str = "{spinner:.green}{wide_msg}{pos}/{len} [{bar:.green/lime}]";
19pub static STYLE_BAR_BYTE: &str = "{spinner:.green}{wide_msg}{bytes}/{total_bytes} [{bar:.green/lime}]"; 18pub static STYLE_BAR_BYTE: &str = "{spinner:.green}{wide_msg}{bytes}/{total_bytes} [{bar:.green/lime}]";
19pub static STYLE_BAR_POS: &str = " {wide_msg}{pos}/{len} [{bar:.green/lime}]";
20pub static STYLE_SPINNER: &str = "{spinner:.green}{wide_msg}"; 20pub static STYLE_SPINNER: &str = "{spinner:.green}{wide_msg}";
21pub static STYLE_OPERATION: &str = " {wide_msg}";
21pub static STYLE_MESSAGE: &str = "{wide_msg}"; 22pub static STYLE_MESSAGE: &str = "{wide_msg}";
22pub static PROGRESS_CHARS: &str = "#>-"; 23pub static PROGRESS_CHARS: &str = "#>-";
23 24
@@ -70,7 +71,7 @@ pub async fn check_game_versions(path: &str, force: bool) -> MLE<()> {
70 71
71 let creation_time = fs::metadata(path)?.created()?; 72 let creation_time = fs::metadata(path)?.created()?;
72 if !force && creation_time.elapsed().unwrap() < Duration::from_secs(60 * 60 * 24) { return Ok(()); } 73 if !force && creation_time.elapsed().unwrap() < Duration::from_secs(60 * 60 * 24) { return Ok(()); }
73 std::io::stdout().flush()?; 74
74 let versions = get_game_versions().await; 75 let versions = get_game_versions().await;
75 remove_file(path)?; 76 remove_file(path)?;
76 let mut file = File::create(path)?; 77 let mut file = File::create(path)?;