Skip to content

Commit

Permalink
Make ShowManagedFields public so printers users can tweak the value
Browse files Browse the repository at this point in the history
  • Loading branch information
soltysh committed Feb 4, 2022
1 parent 8e5089a commit 47d8450
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 47d8450

Please sign in to comment.