Skip to content

Commit

Permalink
disable with -v
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Oct 22, 2024
1 parent 7509475 commit 7fba995
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bin/src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
)
}

0 comments on commit 7fba995

Please sign in to comment.