From 47d8450c900060bb05278228e68c80e1947c035e Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Fri, 4 Feb 2022 13:41:15 +0100 Subject: [PATCH] Make ShowManagedFields public so printers users can tweak the value --- .../cli-runtime/pkg/genericclioptions/json_yaml_flags.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/json_yaml_flags.go b/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/json_yaml_flags.go index 0f2bdcdaf03..ea8789614ea 100644 --- a/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/json_yaml_flags.go +++ b/staging/src/k8s.io/cli-runtime/pkg/genericclioptions/json_yaml_flags.go @@ -36,7 +36,7 @@ func (f *JSONYamlPrintFlags) AllowedFormats() []string { // Given the following flag values, a printer can be requested that knows // how to handle printing based on these values. type JSONYamlPrintFlags struct { - showManagedFields bool + ShowManagedFields bool } // ToPrinter receives an outputFormat and returns a printer capable of @@ -56,7 +56,7 @@ func (f *JSONYamlPrintFlags) ToPrinter(outputFormat string) (printers.ResourcePr return nil, NoCompatiblePrinterError{OutputFormat: &outputFormat, AllowedFormats: f.AllowedFormats()} } - if !f.showManagedFields { + if !f.ShowManagedFields { printer = &printers.OmitManagedFieldsPrinter{Delegate: printer} } return printer, nil @@ -69,7 +69,7 @@ func (f *JSONYamlPrintFlags) AddFlags(c *cobra.Command) { return } - c.Flags().BoolVar(&f.showManagedFields, "show-managed-fields", f.showManagedFields, "If true, keep the managedFields when printing objects in JSON or YAML format.") + c.Flags().BoolVar(&f.ShowManagedFields, "show-managed-fields", f.ShowManagedFields, "If true, keep the managedFields when printing objects in JSON or YAML format.") } // NewJSONYamlPrintFlags returns flags associated with