diff options
author | fxqnlr <[email protected]> | 2023-05-25 21:06:40 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-05-25 21:06:40 +0200 |
commit | 7f1a262999d7a8b7f12a97daf4b6722638dc62a1 (patch) | |
tree | c030a952891fba2f64427adad1113efc567ae54d /src/commands/modification.rs | |
parent | 48393b209396db9ddd44251b2bb445d3ad7533fb (diff) | |
download | modlist-7f1a262999d7a8b7f12a97daf4b6722638dc62a1.tar modlist-7f1a262999d7a8b7f12a97daf4b6722638dc62a1.tar.gz modlist-7f1a262999d7a8b7f12a97daf4b6722638dc62a1.zip |
more progress instead of print, more references
Diffstat (limited to 'src/commands/modification.rs')
-rw-r--r-- | src/commands/modification.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/commands/modification.rs b/src/commands/modification.rs index 31931f8..d369c4b 100644 --- a/src/commands/modification.rs +++ b/src/commands/modification.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::{io::Write, collections::HashMap}; | 1 | use std::{io::Write, collections::HashMap}; |
2 | 2 | ||
3 | use indicatif::{ProgressBar, ProgressStyle}; | 3 | use indicatif::{ProgressBar, ProgressStyle, MultiProgress}; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | config::Cfg, | 6 | config::Cfg, |
@@ -11,16 +11,16 @@ use crate::{ | |||
11 | error::{ErrorType, MLError, MLE}, | 11 | error::{ErrorType, MLError, MLE}, |
12 | files::{delete_version, download_versions}, | 12 | files::{delete_version, download_versions}, |
13 | modrinth::{extract_current_version, get_raw_versions, project, projects, versions, Version}, | 13 | modrinth::{extract_current_version, get_raw_versions, project, projects, versions, Version}, |
14 | List, PROGRESS_CHARS, | 14 | List, PROGRESS_CHARS, STYLE_BAR_POS, STYLE_SPINNER, |
15 | }; | 15 | }; |
16 | 16 | ||
17 | #[derive(Debug, Clone)] | 17 | #[derive(Debug)] |
18 | pub struct AddMod { | 18 | pub struct AddMod { |
19 | pub id: IDSelector, | 19 | pub id: IDSelector, |
20 | pub set_version: bool | 20 | pub set_version: bool |
21 | } | 21 | } |
22 | 22 | ||
23 | #[derive(Debug, Clone, PartialEq, Eq)] | 23 | #[derive(Debug, PartialEq, Eq)] |
24 | pub enum IDSelector { | 24 | pub enum IDSelector { |
25 | ModificationID(String), | 25 | ModificationID(String), |
26 | VersionID(String), | 26 | VersionID(String), |
@@ -43,12 +43,11 @@ pub async fn mod_add( | |||
43 | list: List, | 43 | list: List, |
44 | direct_download: bool, | 44 | direct_download: bool, |
45 | ) -> MLE<()> { | 45 | ) -> MLE<()> { |
46 | let spinner_style = ProgressStyle::with_template("{spinner:.green}{msg}").unwrap(); | ||
47 | let bar_style = ProgressStyle::with_template("{spinner:.green}{wide_msg}{pos}/{len} [{bar:.green/lime}]").unwrap().progress_chars(PROGRESS_CHARS); | ||
48 | 46 | ||
49 | // println!("Add mods to {}", list.id); | 47 | //TODO MultiProgress |
50 | // println!(" └Add mods:"); | ||
51 | 48 | ||
49 | let spinner_style = ProgressStyle::with_template(STYLE_SPINNER).unwrap(); | ||
50 | let bar_style = ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS); | ||
52 | let mut mod_ids: Vec<(String, bool)> = Vec::new(); | 51 | let mut mod_ids: Vec<(String, bool)> = Vec::new(); |
53 | let mut ver_ids: Vec<(String, bool)> = Vec::new(); | 52 | let mut ver_ids: Vec<(String, bool)> = Vec::new(); |
54 | 53 | ||
@@ -153,7 +152,8 @@ pub async fn mod_add( | |||
153 | 152 | ||
154 | //Download all the added mods | 153 | //Download all the added mods |
155 | if direct_download { | 154 | if direct_download { |
156 | download_versions(list.clone(), config.clone(), downloadstack).await?; | 155 | let mp = MultiProgress::new(); |
156 | download_versions(list.clone(), config.clone(), downloadstack, &mp, None).await?; | ||
157 | }; | 157 | }; |
158 | 158 | ||
159 | Ok(()) | 159 | Ok(()) |