Skip to content

Commit

Permalink
Standardize on canonical way to suppress progress bars with --quiet o…
Browse files Browse the repository at this point in the history
…ption
  • Loading branch information
jqnatividad committed Dec 7, 2021
1 parent d75fed4 commit 9995b72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/cmd/foreach.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::config::{Config, Delimiter};
use crate::select::SelectColumns;
use crate::util;
use crate::CliResult;
use indicatif::ProgressBar;
use indicatif::{ProgressBar, ProgressDrawTarget};
use serde::Deserialize;

static USAGE: &str = "
Expand Down Expand Up @@ -92,6 +92,8 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
if !args.flag_quiet {
record_count = util::count_rows(&rconfig);
util::prep_progress(&progress, record_count);
} else {
progress.set_draw_target(ProgressDrawTarget::hidden());
}

while rdr.read_byte_record(&mut record)? {
Expand Down
4 changes: 3 additions & 1 deletion src/cmd/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::util;
use crate::CliError;
use crate::CliResult;
use hlua::{AnyLuaValue, Lua, LuaError, LuaTable};
use indicatif::ProgressBar;
use indicatif::{ProgressBar, ProgressDrawTarget};
use serde::Deserialize;

// TODO: options for boolean return coercion
Expand Down Expand Up @@ -153,6 +153,8 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
if !args.flag_quiet {
record_count = util::count_rows(&rconfig);
util::prep_progress(&progress, record_count);
} else {
progress.set_draw_target(ProgressDrawTarget::hidden());
}

let mut record = csv::StringRecord::new();
Expand Down

0 comments on commit 9995b72

Please sign in to comment.