on master help sign in
Paint STDOUT bold, unify writeln statement
commit438f3df34567448c915a262c47bf05cb67fcc884 authorsharkdp <davidpeter@web.de> dateMon 7 May 2018, 22:26 (9 years ago) parent7e2e0c8
1 file changed+6−8
src/printer.rs+6−8
src/printer.rs+6−8
@@ -51,14 +51,12 @@ impl<'a> Printer<'a> {
5151 self.colors.grid.paint("│"),
5252 )?;
5353
54− match filename {
55− None => {
56− writeln!(self.handle, "STDIN",)?;
57− }
58− Some(filename) => {
59− writeln!(self.handle, "File {}", self.colors.filename.paint(filename))?;
60− }
61− }
54+ writeln!(
55+ self.handle,
56+ "{}{}",
57+ filename.map_or("", |_| "File: "),
58+ self.colors.filename.paint(filename.unwrap_or("STDIN"))
59+ )?;
6260
6361 self.print_horizontal_line('┼')
6462 }