fix: add printer method to reset ansi formatting

This commit is contained in:
alexpasmantier 2024-07-22 21:43:20 +02:00
parent 600516bad1
commit e4d3e7a86b
4 changed files with 9 additions and 4 deletions

2
Cargo.lock generated
View File

@ -297,7 +297,7 @@ dependencies = [
[[package]]
name = "grip-grab"
version = "0.2.6"
version = "0.2.8"
dependencies = [
"anyhow",
"clap",

View File

@ -1,6 +1,6 @@
[package]
name = "grip-grab"
version = "0.2.6"
version = "0.2.8"
edition = "2021"
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
license = "Apache-2.0"

View File

@ -63,6 +63,5 @@ pub fn main() -> anyhow::Result<()> {
.for_each(|file_results| printer.write(file_results).unwrap());
printer.print()?;
Ok(())
}

View File

@ -131,6 +131,12 @@ impl Printer {
}
pub fn print(&mut self) -> Result<()> {
self.writer.print(&self.buffer)
self.writer.print(&self.buffer);
self.reset_ansi_formatting()
}
fn reset_ansi_formatting(&mut self) -> Result<()> {
self.buffer.reset();
self.write_newline_to_buffer()
}
}