From e944f1037283cd215d8152ff29a4cfee4852de72 Mon Sep 17 00:00:00 2001 From: Pi Lanningham Date: Fri, 8 Mar 2024 17:36:32 -0500 Subject: [PATCH] Add an optional check count; when we run a command that runs tests, we can set this to Some(x) and it'll print in the summary --- crates/aiken-project/src/watch.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/aiken-project/src/watch.rs b/crates/aiken-project/src/watch.rs index 591ec8e3..2ae04ffc 100644 --- a/crates/aiken-project/src/watch.rs +++ b/crates/aiken-project/src/watch.rs @@ -24,6 +24,7 @@ impl ExitFailure { } struct Summary { + check_count: Option, warning_count: usize, error_count: usize, } @@ -31,10 +32,18 @@ struct Summary { impl Display for Summary { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(&format!( - " {} {} {}, {} {}", + " {} {}{}{} {}, {} {}", "Summary" .if_supports_color(Stderr, |s| s.purple()) .if_supports_color(Stderr, |s| s.bold()), + if let Some(c) = self.check_count { format!("{} ", c) } else { "".to_string() }, + match self.check_count { + Some(1) => "check, ", + Some(_) => "checks, ", + None => "" + } + .if_supports_color(Stderr, |s| s.green()) + .if_supports_color(Stderr, |s| s.bold()), self.error_count, if self.error_count == 1 { "error" @@ -111,6 +120,7 @@ where eprintln!( "{}", Summary { + check_count: None, warning_count, error_count: errs.len(), } @@ -122,6 +132,7 @@ where eprintln!( "{}", Summary { + check_count: Some(41), error_count: 0, warning_count }