on master help sign in
Paint STDOUT bold, unify writeln statement
438f3dfsharkdp
src/printer.rs+6−8
@@ -51,14 +51,12 @@ impl<'a> Printer<'a> {
51 self.colors.grid.paint("│"),
51 self.colors.grid.paint("│"),
52 )?;
52 )?;
53
53
54− match filename {
54+ writeln!(
55− None => {
56− writeln!(self.handle, "STDIN",)?;
55+ self.handle,
57− }
56+ "{}{}",
58− Some(filename) => {
57+ filename.map_or("", |_| "File: "),
59− writeln!(self.handle, "File {}", self.colors.filename.paint(filename))?;
58+ self.colors.filename.paint(filename.unwrap_or("STDIN"))
60− }
59+ )?;
61− }
62
60
63 self.print_horizontal_line('┼')
61 self.print_horizontal_line('┼')
64 }
62 }