mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-22 19:42:31 +00:00
refactor printing error counts
This commit is contained in:
parent
ea53a50447
commit
32e3f01a28
2 changed files with 33 additions and 33 deletions
|
@ -20,6 +20,34 @@ impl Problems {
|
|||
self.warnings.min(1) as i32
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_to_stdout(&self, total_time: std::time::Duration) {
|
||||
const GREEN: usize = 32;
|
||||
const YELLOW: usize = 33;
|
||||
|
||||
print!(
|
||||
"\x1B[{}m{}\x1B[39m {} and \x1B[{}m{}\x1B[39m {} found in {} ms",
|
||||
match self.errors {
|
||||
0 => GREEN,
|
||||
_ => YELLOW,
|
||||
},
|
||||
self.errors,
|
||||
match self.errors {
|
||||
1 => "error",
|
||||
_ => "errors",
|
||||
},
|
||||
match self.warnings {
|
||||
0 => GREEN,
|
||||
_ => YELLOW,
|
||||
},
|
||||
self.warnings,
|
||||
match self.warnings {
|
||||
1 => "warning",
|
||||
_ => "warnings",
|
||||
},
|
||||
total_time.as_millis(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn report_problems(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue