fix output
This commit is contained in:
parent
9a4875bfd0
commit
634e36e547
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sys-compare"
|
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."
|
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"
|
edition = "2021"
|
||||||
authors = ["james@koonts.net"]
|
authors = ["james@koonts.net"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -53,30 +53,30 @@ impl CompareMode {
|
|||||||
self.result_type = results.0;
|
self.result_type = results.0;
|
||||||
|
|
||||||
macro_rules! print_if_not_empty {
|
macro_rules! print_if_not_empty {
|
||||||
($ret:expr, $co:expr) => {
|
($ret:expr, $co:expr, $msg:expr) => {
|
||||||
if let Some(count_only) = $co {
|
if let Some(count_only) = $co {
|
||||||
if count_only {
|
if count_only {
|
||||||
println!("{}", $ret.len());
|
println!("{}", $ret.len());
|
||||||
} else {
|
} else {
|
||||||
$ret.iter().for_each(|e| println!("{e}"));
|
$ret.iter().for_each(|e| println!("{e}"));
|
||||||
println!("Created: {:?}", $ret.len());
|
println!("{}: {:?}", $msg, $ret.len());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ret.iter().for_each(|e| println!("{e}"));
|
$ret.iter().for_each(|e| println!("{e}"));
|
||||||
println!("Created: {:?}", $ret.len());
|
println!("{}: {:?}", $msg, $ret.len());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
match selector {
|
match selector {
|
||||||
"created" => {
|
"created" => {
|
||||||
print_if_not_empty!(self.results.created, self.count_only);
|
print_if_not_empty!(self.results.created, self.count_only, "Created");
|
||||||
}
|
}
|
||||||
"deleted" => {
|
"deleted" => {
|
||||||
print_if_not_empty!(self.results.deleted, self.count_only);
|
print_if_not_empty!(self.results.deleted, self.count_only, "Deleted");
|
||||||
}
|
}
|
||||||
"changed" => {
|
"changed" => {
|
||||||
print_if_not_empty!(self.results.changed, self.count_only);
|
print_if_not_empty!(self.results.changed, self.count_only, "Changed");
|
||||||
}
|
}
|
||||||
"none" => {
|
"none" => {
|
||||||
println!("Created: {:?}", self.results.created.len());
|
println!("Created: {:?}", self.results.created.len());
|
||||||
|
Loading…
Reference in New Issue
Block a user