Add a silent mode for running the diff.

This commit is contained in:
Tom Alexander
2023-10-14 14:47:57 -04:00
parent dde4bc7920
commit f43920fc7c
4 changed files with 64 additions and 26 deletions

View File

@@ -34,10 +34,17 @@ fn main_body() -> Result<(), Box<dyn std::error::Error>> {
let args = std::env::args().skip(1);
if args.is_empty() {
let org_contents = read_stdin_to_string()?;
run_anonymous_compare(org_contents)
if let Ok(true) = run_anonymous_compare(org_contents) {
} else {
Err("Diff results do not match.")?;
}
Ok(())
} else {
for arg in args {
run_compare_on_file(arg)?
if run_compare_on_file(arg)? {
} else {
Err("Diff results do not match.")?;
}
}
Ok(())
}