From 7fba99504f0af02d8288e0da55989243f91f72a2 Mon Sep 17 00:00:00 2001 From: Brett Mayson Date: Tue, 22 Oct 2024 00:56:20 +0000 Subject: [PATCH] disable with -v --- bin/src/progress.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bin/src/progress.rs b/bin/src/progress.rs index eab9f96f..38c44d64 100644 --- a/bin/src/progress.rs +++ b/bin/src/progress.rs @@ -3,11 +3,15 @@ use indicatif::{ProgressBar, ProgressStyle}; #[allow(clippy::module_name_repetitions)] pub fn progress_bar(size: u64) -> ProgressBar { ProgressBar::new(size).with_style( - ProgressStyle::with_template(if std::env::var("CI").is_ok() { - "" - } else { - "{msg} [{elapsed_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} " - }) + ProgressStyle::with_template( + if std::env::var("CI").is_ok() + || std::env::args().any(|a| a.starts_with("-v") && a.ends_with('v')) + { + "" + } else { + "{msg} [{elapsed_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} " + }, + ) .expect("valid template"), ) }