From c709bf21031859d4f6a98d574e73cd31b6cc3bff Mon Sep 17 00:00:00 2001 From: sharkdp Date: Tue, 14 May 2019 23:14:41 +0200 Subject: [PATCH] Print a warning message instead of just '' --- src/printer.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/printer.rs b/src/printer.rs index b264792333..0e68b4d119 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -195,7 +195,18 @@ impl<'a> Printer for InteractivePrinter<'a> { fn print_header(&mut self, handle: &mut Write, file: InputFile) -> Result<()> { if !self.config.output_components.header() { if ContentType::BINARY == self.content_type { - writeln!(handle, "")?; + let input = match file { + InputFile::Ordinary(filename) => format!("file '{}'", filename), + _ => "STDIN".into(), + }; + + writeln!( + handle, + "{}: Binary content from {} will not be printed to the terminal \ + (but will be present if the output of 'bat' is piped).", + Yellow.paint("[bat warning]"), + input + )?; } return Ok(()); }