Add summary

This commit is contained in:
Roey Darwish Dror
2018-06-03 18:04:58 +03:00
parent d473b288b3
commit 239ad6e4f3
5 changed files with 108 additions and 20 deletions

View File

@@ -47,4 +47,31 @@ impl Terminal {
}
}
}
pub fn print_result<P: AsRef<str>>(&self, key: P, succeeded: bool) {
let key = key.as_ref();
match self.width {
Some(_) => {
if succeeded {
println!(
"{}: {}OK{}",
key,
color::Fg(color::LightGreen),
color::Fg(color::Reset)
);
} else {
println!(
"{}: {}FAILED{}",
key,
color::Fg(color::LightRed),
color::Fg(color::Reset)
);
}
}
None => {
println!("{}: {}", key, if succeeded { "OK" } else { "FAILED" });
}
}
}
}