From f02ea9b065735175f80413884ecf24ddbd779218 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Wed, 8 Nov 2023 12:10:42 +0100 Subject: [PATCH] Show issue counts ahead of issue list --- src/main.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 14255fa..217cbe8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,7 +32,7 @@ use std::path::{Path, PathBuf}; use std::str::FromStr; use crate::checks::osc::check; -use crate::checks::print_checks; +use crate::checks::{print_checks, CheckNotice}; use clap::Parser; use console::style; use dialoguer::Confirm; @@ -269,7 +269,18 @@ fn main() -> Result<(), Box> { if list { print_checks(); } else { - check(Path::new(file.as_str())) + let notices = check(Path::new(file.as_str())); + println!( + "Es wurden {} Probleme gefunden\n", + notices + .iter() + .filter(|notice| match notice { + CheckNotice::ErrorWithCode { .. } | CheckNotice::Error { .. } => true, + _ => false, + }) + .count() + ); + notices .iter() .for_each(|check_notice| println!("{}", check_notice)); }