drop print-failures arg
This commit is contained in:
parent
6f0c2c0f44
commit
53e860989e
1 changed files with 6 additions and 22 deletions
28
src/main.rs
28
src/main.rs
|
@ -118,13 +118,6 @@ struct Args {
|
||||||
long,
|
long,
|
||||||
help = "(only used with -c) Only print checksums that fail; do not print OK for files that are successful"
|
help = "(only used with -c) Only print checksums that fail; do not print OK for files that are successful"
|
||||||
)]
|
)]
|
||||||
failures_only: bool,
|
|
||||||
|
|
||||||
#[arg(
|
|
||||||
short = 'Q',
|
|
||||||
long,
|
|
||||||
help = "(only used with -c) Suppress all output to stdout, including failures"
|
|
||||||
)]
|
|
||||||
quiet: bool,
|
quiet: bool,
|
||||||
|
|
||||||
#[arg(trailing_var_arg = true)]
|
#[arg(trailing_var_arg = true)]
|
||||||
|
@ -134,7 +127,6 @@ struct Args {
|
||||||
struct ThreadInfo {
|
struct ThreadInfo {
|
||||||
debug: bool,
|
debug: bool,
|
||||||
quiet: bool,
|
quiet: bool,
|
||||||
print_failures: bool,
|
|
||||||
thread_id: usize,
|
thread_id: usize,
|
||||||
filenames: Arc<Mutex<VecDeque<PathBuf>>>,
|
filenames: Arc<Mutex<VecDeque<PathBuf>>>,
|
||||||
algorithm: Arc<String>,
|
algorithm: Arc<String>,
|
||||||
|
@ -166,7 +158,7 @@ fn hash(info: ThreadInfo) -> Result<(), String> {
|
||||||
|
|
||||||
let file = match File::open(&filename) {
|
let file = match File::open(&filename) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
common::error(format!("{}: {}", filename.as_path().display(), e));
|
println!("{}: FAILED ({})", filename.as_path().display(), e);
|
||||||
info.file_errors.fetch_add(1, Ordering::SeqCst);
|
info.file_errors.fetch_add(1, Ordering::SeqCst);
|
||||||
continue;
|
continue;
|
||||||
},
|
},
|
||||||
|
@ -223,8 +215,10 @@ fn hash(info: ThreadInfo) -> Result<(), String> {
|
||||||
|
|
||||||
match &info.hash_map {
|
match &info.hash_map {
|
||||||
Some(h) => {
|
Some(h) => {
|
||||||
if h.lock().unwrap()[&filename] == res && !info.quiet {
|
if h.lock().unwrap()[&filename] == res {
|
||||||
println!("{}: OK", filename.as_path().display());
|
if !info.quiet {
|
||||||
|
println!("{}: OK", filename.as_path().display());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("{}: FAILED", filename.as_path().display());
|
println!("{}: FAILED", filename.as_path().display());
|
||||||
info.hash_errors.fetch_add(1, Ordering::SeqCst);
|
info.hash_errors.fetch_add(1, Ordering::SeqCst);
|
||||||
|
@ -250,7 +244,6 @@ fn verify(
|
||||||
algorithm: String,
|
algorithm: String,
|
||||||
debug: bool,
|
debug: bool,
|
||||||
quiet: bool,
|
quiet: bool,
|
||||||
print_failures: bool,
|
|
||||||
checksum_files: Vec<PathBuf>,
|
checksum_files: Vec<PathBuf>,
|
||||||
) -> (
|
) -> (
|
||||||
Vec<JoinHandle<Result<(), std::string::String>>>,
|
Vec<JoinHandle<Result<(), std::string::String>>>,
|
||||||
|
@ -296,7 +289,6 @@ fn verify(
|
||||||
hash(ThreadInfo {
|
hash(ThreadInfo {
|
||||||
debug,
|
debug,
|
||||||
quiet,
|
quiet,
|
||||||
print_failures,
|
|
||||||
thread_id: i,
|
thread_id: i,
|
||||||
filenames: safe_buf,
|
filenames: safe_buf,
|
||||||
algorithm: safe_alg,
|
algorithm: safe_alg,
|
||||||
|
@ -334,7 +326,6 @@ fn generate(
|
||||||
hash(ThreadInfo {
|
hash(ThreadInfo {
|
||||||
debug,
|
debug,
|
||||||
quiet,
|
quiet,
|
||||||
print_failures: false,
|
|
||||||
thread_id: i,
|
thread_id: i,
|
||||||
filenames: safe_buf,
|
filenames: safe_buf,
|
||||||
algorithm: safe_alg,
|
algorithm: safe_alg,
|
||||||
|
@ -373,14 +364,7 @@ fn main() {
|
||||||
let arc_fe;
|
let arc_fe;
|
||||||
let arc_he;
|
let arc_he;
|
||||||
if &args.check.len() >= &1 {
|
if &args.check.len() >= &1 {
|
||||||
(handles, arc_fe, arc_he) = verify(
|
(handles, arc_fe, arc_he) = verify(cpus, args.algorithm, args.debug, args.quiet, args.check);
|
||||||
cpus,
|
|
||||||
args.algorithm,
|
|
||||||
args.debug,
|
|
||||||
args.quiet,
|
|
||||||
args.failures_only,
|
|
||||||
args.check,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
let mut buffer = VecDeque::new();
|
let mut buffer = VecDeque::new();
|
||||||
for file in args.files {
|
for file in args.files {
|
||||||
|
|
Loading…
Add table
Reference in a new issue