summaryrefslogtreecommitdiff
path: root/src/commands/modification.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-05-25 21:06:40 +0200
committerfxqnlr <[email protected]>2023-05-25 21:06:40 +0200
commit7f1a262999d7a8b7f12a97daf4b6722638dc62a1 (patch)
treec030a952891fba2f64427adad1113efc567ae54d /src/commands/modification.rs
parent48393b209396db9ddd44251b2bb445d3ad7533fb (diff)
downloadmodlist-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.rs18
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 @@
1use std::{io::Write, collections::HashMap}; 1use std::{io::Write, collections::HashMap};
2 2
3use indicatif::{ProgressBar, ProgressStyle}; 3use indicatif::{ProgressBar, ProgressStyle, MultiProgress};
4 4
5use crate::{ 5use 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)]
18pub struct AddMod { 18pub 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)]
24pub enum IDSelector { 24pub 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(())