From 5694cc51947c3c87c483ea4850a441bc995aef31 Mon Sep 17 00:00:00 2001 From: Laurence Withers Date: Fri, 7 Jul 2023 11:21:41 +0100 Subject: [PATCH] Move printedFull closer to its use, document --- file.go | 9 +++++++++ main.go | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/file.go b/file.go index 900c445..0843510 100644 --- a/file.go +++ b/file.go @@ -68,6 +68,15 @@ func (nptf *notPlainTextFlag) Type() string { return "short|full|skip" // ??? } +var ( + // printedFull is set by file() if it prints a full file's matches + // (i.e. a header line, then the match lines). It is cleared if we + // just printed a "Binary file matches" line. It lets us have a + // nice one-line separator between full files, but show the binary + // matches compactly. + printedFull bool +) + func file(path string, data []byte) { var short string isBinary, isMinified := notPlainText(data) diff --git a/main.go b/main.go index 4390727..7534413 100644 --- a/main.go +++ b/main.go @@ -63,7 +63,6 @@ var ( ignoreCase bool noColour bool display *Display - printedFull bool ) func init() {