1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-12 00:02:28 +01:00

Add InputDescription API

This commit is contained in:
Ethan P
2020-05-15 16:18:10 -07:00
committed by David Peter
parent 384ea38bd9
commit 981352992b
3 changed files with 93 additions and 48 deletions

View File

@@ -249,7 +249,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
(but will be present if the output of 'bat' is piped). You can use 'bat -A' \
to show the binary file contents.",
Yellow.paint("[bat warning]"),
input.description().full,
input.description.summary(),
)?;
} else if self.config.style_components.grid() {
self.print_horizontal_line(handle, '┬')?;
@@ -283,13 +283,16 @@ impl<'a> Printer for InteractivePrinter<'a> {
_ => "",
};
let description = input.description();
let description = &input.description;
writeln!(
handle,
"{}{}{}",
description.prefix,
self.colors.filename.paint(&description.name),
description
.kind()
.map(|kind| format!("{}: ", kind))
.unwrap_or("".into()),
self.colors.filename.paint(description.name()),
mode
)?;