Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate: add --trim and --quiet options #1452

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
validate: Add quiet flag
  • Loading branch information
jqnatividad committed Dec 5, 2023
commit 506145f205e5567de0d0a5a1c036f5f912029058
10 changes: 8 additions & 2 deletions src/cmd/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Common options:
-d, --delimiter <arg> The field delimiter for reading CSV data.
Must be a single character. [default: ,]
-p, --progressbar Show progress bars. Not valid for stdin.
-Q, --quiet Do not display validation summary message.
"#;

use std::{
Expand Down Expand Up @@ -148,6 +149,7 @@ struct Args {
flag_no_headers: bool,
flag_delimiter: Option<Delimiter>,
flag_progressbar: bool,
flag_quiet: bool,
arg_input: Option<String>,
arg_json_schema: Option<String>,
flag_timeout: u16,
Expand Down Expand Up @@ -384,7 +386,9 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
HumanCount(record_idx)
)
};
woutinfo!("{msg}");
if !args.flag_quiet {
woutinfo!("{msg}");
}

// we're done when validating without a schema
return Ok(());
Expand Down Expand Up @@ -582,7 +586,9 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
);
}

winfo!("All {} records valid.", HumanCount(row_number));
if !args.flag_quiet {
winfo!("All {} records valid.", HumanCount(row_number));
}
Ok(())
}

Expand Down