From 4894d1b4db91951225f6f90a809d0042a37642fa Mon Sep 17 00:00:00 2001 From: sreedevk Date: Sat, 19 Jul 2025 11:43:26 +0000 Subject: [PATCH] minor ui improvements --- src/formatter.rs | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/formatter.rs b/src/formatter.rs index 3826467..731f644 100644 --- a/src/formatter.rs +++ b/src/formatter.rs @@ -34,32 +34,31 @@ impl Formatter { } pub fn print(raw: Arc>>, max_path_len: u64, aargs: &Params) { - print!("\n\n\n"); // spacing + print!("{}", "\n".repeat(if aargs.progress { 2 } else { 1 })); // spacing if raw.is_empty() { println!("No duplicates found matching your search criteria."); - return; + } else { + raw.par_iter().for_each(|sref| { + let mut ostring = format!("{}{:32x}{}\n", YELLOW, sref.key(), RESET); + let subfields = sref + .value() + .par_iter() + .map(|finfo| { + format!( + "├─ {}\t{}\t{}\n", + Self::human_path(finfo, aargs, max_path_len as usize) + .expect("path formatting failed."), + Self::human_filesize(finfo).expect("filesize formatting failed."), + Self::human_mtime(finfo).expect("modified time formatting failed.") + ) + }) + .collect::(); + + ostring.push_str(&subfields); + + println!("{ostring}"); + }); } - - raw.par_iter().for_each(|sref| { - let mut ostring = format!("{}{:32x}{}\n", YELLOW, sref.key(), RESET); - let subfields = sref - .value() - .par_iter() - .map(|finfo| { - format!( - "├─ {}\t{}\t{}\n", - Self::human_path(finfo, aargs, max_path_len as usize) - .expect("path formatting failed."), - Self::human_filesize(finfo).expect("filesize formatting failed."), - Self::human_mtime(finfo).expect("modified time formatting failed.") - ) - }) - .collect::(); - - ostring.push_str(&subfields); - - println!("{ostring}"); - }); } }