From 7f1a262999d7a8b7f12a97daf4b6722638dc62a1 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 25 May 2023 21:06:40 +0200 Subject: more progress instead of print, more references --- src/commands/modification.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/commands/modification.rs') 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 @@ use std::{io::Write, collections::HashMap}; -use indicatif::{ProgressBar, ProgressStyle}; +use indicatif::{ProgressBar, ProgressStyle, MultiProgress}; use crate::{ config::Cfg, @@ -11,16 +11,16 @@ use crate::{ error::{ErrorType, MLError, MLE}, files::{delete_version, download_versions}, modrinth::{extract_current_version, get_raw_versions, project, projects, versions, Version}, - List, PROGRESS_CHARS, + List, PROGRESS_CHARS, STYLE_BAR_POS, STYLE_SPINNER, }; -#[derive(Debug, Clone)] +#[derive(Debug)] pub struct AddMod { pub id: IDSelector, pub set_version: bool } -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, PartialEq, Eq)] pub enum IDSelector { ModificationID(String), VersionID(String), @@ -43,12 +43,11 @@ pub async fn mod_add( list: List, direct_download: bool, ) -> MLE<()> { - let spinner_style = ProgressStyle::with_template("{spinner:.green}{msg}").unwrap(); - let bar_style = ProgressStyle::with_template("{spinner:.green}{wide_msg}{pos}/{len} [{bar:.green/lime}]").unwrap().progress_chars(PROGRESS_CHARS); - // println!("Add mods to {}", list.id); - // println!(" └Add mods:"); + //TODO MultiProgress + let spinner_style = ProgressStyle::with_template(STYLE_SPINNER).unwrap(); + let bar_style = ProgressStyle::with_template(STYLE_BAR_POS).unwrap().progress_chars(PROGRESS_CHARS); let mut mod_ids: Vec<(String, bool)> = Vec::new(); let mut ver_ids: Vec<(String, bool)> = Vec::new(); @@ -153,7 +152,8 @@ pub async fn mod_add( //Download all the added mods if direct_download { - download_versions(list.clone(), config.clone(), downloadstack).await?; + let mp = MultiProgress::new(); + download_versions(list.clone(), config.clone(), downloadstack, &mp, None).await?; }; Ok(()) -- cgit v1.2.3