diff --git a/src/backends/gitlab.rs b/src/backends/gitlab.rs index 656d23b..cad43a3 100644 --- a/src/backends/gitlab.rs +++ b/src/backends/gitlab.rs @@ -4,7 +4,6 @@ Gitlab releases use std::env::{self, consts::EXE_SUFFIX}; use std::path::{Path, PathBuf}; -use indicatif::ProgressStyle; use reqwest::{self, header}; use crate::backends::find_rel_next_link; @@ -222,7 +221,8 @@ pub struct UpdateBuilder { no_confirm: bool, current_version: Option, target_version: Option, - progress_style: Option, + progress_template: String, + progress_chars: String, auth_token: Option, } @@ -328,9 +328,10 @@ impl UpdateBuilder { self } - /// Toggle download progress bar, defaults to `off`. - pub fn set_progress_style(&mut self, progress_style: ProgressStyle) -> &mut Self { - self.progress_style = Some(progress_style); + /// Set download progress style. + pub fn set_progress_style(&mut self, progress_template: String, progress_chars: String) -> &mut Self { + self.progress_template = progress_template; + self.progress_chars = progress_chars; self } @@ -402,7 +403,8 @@ impl UpdateBuilder { }, target_version: self.target_version.as_ref().map(|v| v.to_owned()), show_download_progress: self.show_download_progress, - progress_style: self.progress_style.clone(), + progress_template: self.progress_template.clone(), + progress_chars: self.progress_chars.clone(), show_output: self.show_output, no_confirm: self.no_confirm, auth_token: self.auth_token.clone(), @@ -424,7 +426,8 @@ pub struct Update { show_download_progress: bool, show_output: bool, no_confirm: bool, - progress_style: Option, + progress_template: String, + progress_chars: String, auth_token: Option, } impl Update { @@ -515,8 +518,12 @@ impl ReleaseUpdate for Update { self.no_confirm } - fn progress_style(&self) -> Option { - self.progress_style.clone() + fn progress_template(&self) -> String { + self.progress_template.to_owned() + } + + fn progress_chars(&self) -> String { + self.progress_chars.to_owned() } fn auth_token(&self) -> Option { @@ -538,7 +545,8 @@ impl Default for UpdateBuilder { no_confirm: false, current_version: None, target_version: None, - progress_style: None, + progress_template: "[{elapsed_precise}] [{bar:40}] {bytes}/{total_bytes} ({eta}) {msg}".to_string(), + progress_chars: "=>-".to_string(), auth_token: None, } }