Skip to content

Commit

Permalink
foreach: only enable progress-bar for qsv full build
Browse files Browse the repository at this point in the history
- not qsvlite, nor qsvdp
  • Loading branch information
jqnatividad committed Jun 8, 2024
1 parent f50b82d commit 562c07e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/cmd/foreach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ use std::{
str::FromStr,
};

#[cfg(any(feature = "feature_capable", feature = "lite"))]
#[cfg(feature = "feature_capable")]
use indicatif::{ProgressBar, ProgressDrawTarget};
#[cfg(target_family = "windows")]
use local_encoding::windows::multi_byte_to_wide_char;
Expand Down Expand Up @@ -180,20 +180,20 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
let mut cmd_args_string;

// prep progress bar
#[cfg(any(feature = "feature_capable", feature = "lite"))]
#[cfg(feature = "feature_capable")]
let show_progress =
(args.flag_progressbar || util::get_envvar_flag("QSV_PROGRESSBAR")) && !rconfig.is_stdin();
#[cfg(any(feature = "feature_capable", feature = "lite"))]
#[cfg(feature = "feature_capable")]
let progress = ProgressBar::with_draw_target(None, ProgressDrawTarget::stderr_with_hz(5));
#[cfg(any(feature = "feature_capable", feature = "lite"))]
#[cfg(feature = "feature_capable")]
if show_progress {
util::prep_progress(&progress, util::count_rows(&rconfig)?);
} else {
progress.set_draw_target(ProgressDrawTarget::hidden());
}

while rdr.read_byte_record(&mut record)? {
#[cfg(any(feature = "feature_capable", feature = "lite"))]
#[cfg(feature = "feature_capable")]
if show_progress {
progress.inc(1);
}
Expand Down Expand Up @@ -287,7 +287,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
cmd.wait()?;
}
}
#[cfg(any(feature = "feature_capable", feature = "lite"))]
#[cfg(feature = "feature_capable")]
if show_progress {
util::finish_progress(&progress);
}
Expand Down

0 comments on commit 562c07e

Please sign in to comment.