Commit c09311fa authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #40111 from juanvallejo/jvallejo/add-ensure-print-headers

Automatic merge from submit-queue Add printer#EnsurePrintHeaders method This patch adds a new `EnsurePrintHeaders` method to the HumanReadablePrinter `ResourcePrinter`, which allows headers to be printed in cases where multiple lists of the same resource are printed consecutively, but are separated by non-printer related information. Related downstream PR: https://github.com/openshift/origin/pull/12528 **Release note**: ```release-note release-note-none ``` cc @fabianofranz @AdoHe
parents c7d204cb 78ccf2dd
...@@ -419,6 +419,15 @@ func (h *HumanReadablePrinter) EnsurePrintWithKind(kind string) { ...@@ -419,6 +419,15 @@ func (h *HumanReadablePrinter) EnsurePrintWithKind(kind string) {
h.options.Kind = kind h.options.Kind = kind
} }
// EnsurePrintHeaders sets the HumanReadablePrinter option "NoHeaders" to false
// and removes the .lastType that was printed, which forces headers to be
// printed in cases where multiple lists of the same resource are printed
// consecutively, but are separated by non-printer related information.
func (h *HumanReadablePrinter) EnsurePrintHeaders() {
h.options.NoHeaders = false
h.lastType = nil
}
// Handler adds a print handler with a given set of columns to HumanReadablePrinter instance. // Handler adds a print handler with a given set of columns to HumanReadablePrinter instance.
// See validatePrintHandlerFunc for required method signature. // See validatePrintHandlerFunc for required method signature.
func (h *HumanReadablePrinter) Handler(columns, columnsWithWide []string, printFunc interface{}) error { func (h *HumanReadablePrinter) Handler(columns, columnsWithWide []string, printFunc interface{}) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment