mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-07 02:48:27 +08:00
Adding magic to detect leading seperators
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
type Printer interface {
|
||||
PrintResults(matchingNodes *list.List) error
|
||||
PrintedAnything() bool
|
||||
SetPrintLeadingSeperator(bool)
|
||||
}
|
||||
|
||||
type resultsPrinter struct {
|
||||
@@ -40,6 +41,13 @@ func NewPrinter(writer io.Writer, outputToJSON bool, unwrapScalar bool, colorsEn
|
||||
}
|
||||
}
|
||||
|
||||
func (p *resultsPrinter) SetPrintLeadingSeperator(printLeadingSeperator bool) {
|
||||
if printLeadingSeperator {
|
||||
p.firstTimePrinting = false
|
||||
p.previousFileIndex = -1
|
||||
}
|
||||
}
|
||||
|
||||
func (p *resultsPrinter) PrintedAnything() bool {
|
||||
return p.printedMatches
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user