func (f *HumanPrintFlags) AddFlags(flags *pflag.FlagSet) {
	if f.ColumnLabels != nil {
		flags.StringSliceVarP(f.ColumnLabels, flagColumnLabels, flagColumnLabelsShorthand, *f.ColumnLabels, "Accepts a comma separated list of labels that are going to be presented as columns. Names are case-sensitive. You can also use multiple flag options like -L label1 -L label2...")
	}
	if f.NoHeaders != nil {
		flags.BoolVar(f.NoHeaders, flagNoHeaders, *f.NoHeaders, "When using the default output format, don't print headers (default print headers)")
	}
	if f.ShowGroup != nil {
		flags.BoolVar(f.ShowGroup, flagShowGroup, *f.ShowGroup, "If present, include the resource group for the requested object(s)")
	}
	if f.ShowLabels != nil {
		flags.BoolVar(f.ShowLabels, flagShowLabels, *f.ShowLabels, "When printing, show all labels as the last column (default hide labels column)")
	}
	if f.ShowNamespace != nil {
		flags.BoolVar(f.ShowNamespace, flagShowNamespace, *f.ShowNamespace, "When printing, show namespace as the first column (default hide namespace column if all objects are in the same namespace)")
	}
}
AddFlags receives a *pflag.FlagSet reference and binds flags related to
human-readable printing to it.
package printers
import (
	"github.com/spf13/pflag"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"k8s.io/apimachinery/pkg/util/sets"
	"k8s.io/cli-runtime/pkg/genericclioptions"
	"k8s.io/cli-runtime/pkg/printers"
)
const (
	flagColumnLabels          = "label-columns"
	flagColumnLabelsShorthand = "L"
	flagNoHeaders             = "no-headers"
	flagShowGroup             = "show-group"
	flagShowLabels            = "show-labels"
	flagShowNamespace         = "show-namespace"
)
const (
	outputFormatWide      = "wide"
	outputFormatSplit     = "split"
	outputFormatSplitWide = "split-wide"
)
type HumanPrintFlags struct {
	ColumnLabels  *[]string
	NoHeaders     *bool
	ShowGroup     *bool
	ShowLabels    *bool
	ShowNamespace *bool
}
func (f *HumanPrintFlags) EnsureWithGroup() {
	showGroup := true
	f.ShowGroup = &showGroup
}
func (f *HumanPrintFlags) SetShowNamespace(b bool) {
	f.ShowNamespace = &b
}
func (f *HumanPrintFlags) AllowedFormats() []string {
	return []string{
		outputFormatWide,
		outputFormatSplit,
		outputFormatSplitWide,
	}
}
func (f *HumanPrintFlags) IsSupportedOutputFormat(outputFormat string) bool {
	return sets.NewString(f.AllowedFormats()...).Has(outputFormat)
}
func (f *HumanPrintFlags) IsSplitOutputFormat(outputFormat string) bool {
	return outputFormat == outputFormatSplit || outputFormat == outputFormatSplitWide
}
func (f *HumanPrintFlags) IsWideOutputFormat(outputFormat string) bool {
	return outputFormat == outputFormatWide || outputFormat == outputFormatSplitWide
}
func (f *HumanPrintFlags) ToPrinterWithGK(outputFormat string, gk schema.GroupKind) (printers.ResourcePrinter, error) {
	if len(outputFormat) > 0 && !f.IsSupportedOutputFormat(outputFormat) {
		return nil, genericclioptions.NoCompatiblePrinterError{
			Options:        f,
			AllowedFormats: f.AllowedFormats(),
		}
	}
	columnLabels := []string{}
	if f.ColumnLabels != nil {
		columnLabels = *f.ColumnLabels
	}
	noHeaders := false
	if f.NoHeaders != nil {
		noHeaders = *f.NoHeaders
	}
	showLabels := false
	if f.ShowLabels != nil {
		showLabels = *f.ShowLabels
	}
	showNamespace := false
	if f.ShowLabels != nil {
		showNamespace = *f.ShowNamespace
	}
	p := printers.NewTablePrinter(printers.PrintOptions{
		ColumnLabels:  columnLabels,
		NoHeaders:     noHeaders,
		ShowLabels:    showLabels,
		Kind:          gk,
		WithKind:      !gk.Empty(),
		Wide:          f.IsWideOutputFormat(outputFormat),
		WithNamespace: showNamespace,
	})
	return p, nil
}
func (f *HumanPrintFlags) ToPrinter(outputFormat string) (printers.ResourcePrinter, error) {
	return f.ToPrinterWithGK(outputFormat, schema.GroupKind{})
}