From 634e36e547ae2fe3fdb0d301807800f05b7ad374 Mon Sep 17 00:00:00 2001 From: jamesk Date: Tue, 16 Apr 2024 15:01:17 -0400 Subject: [PATCH] fix output --- Cargo.toml | 2 +- src/comparemode.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 049fcef..7e2dba3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sys-compare" description = "Track Filesystem Integrity via 'Snapshots' which contain a HashMap of the files and their corresponding hash signature from a specified directory." -version = "0.2.2" +version = "0.2.3" edition = "2021" authors = ["james@koonts.net"] license = "MIT" diff --git a/src/comparemode.rs b/src/comparemode.rs index c36d299..4ae2745 100644 --- a/src/comparemode.rs +++ b/src/comparemode.rs @@ -53,30 +53,30 @@ impl CompareMode { self.result_type = results.0; macro_rules! print_if_not_empty { - ($ret:expr, $co:expr) => { + ($ret:expr, $co:expr, $msg:expr) => { if let Some(count_only) = $co { if count_only { println!("{}", $ret.len()); } else { $ret.iter().for_each(|e| println!("{e}")); - println!("Created: {:?}", $ret.len()); + println!("{}: {:?}", $msg, $ret.len()); } } else { $ret.iter().for_each(|e| println!("{e}")); - println!("Created: {:?}", $ret.len()); + println!("{}: {:?}", $msg, $ret.len()); } }; } match selector { "created" => { - print_if_not_empty!(self.results.created, self.count_only); + print_if_not_empty!(self.results.created, self.count_only, "Created"); } "deleted" => { - print_if_not_empty!(self.results.deleted, self.count_only); + print_if_not_empty!(self.results.deleted, self.count_only, "Deleted"); } "changed" => { - print_if_not_empty!(self.results.changed, self.count_only); + print_if_not_empty!(self.results.changed, self.count_only, "Changed"); } "none" => { println!("Created: {:?}", self.results.created.len());