// TODO(juanvallejo): enable this here once we wire commands to instantiate PrintFlags directly.
// PrintHandlers are currently added through cmd/util/printing.go#PrinterForOptions
//printersinternal.AddHandlers(p)
// TODO(juanvallejo): handle sorting here
returnp,true,nil
}
// AddFlags receives a *cobra.Command reference and binds
// flags related to human-readable printing to it
func(f*HumanPrintFlags)AddFlags(c*cobra.Command){
iff.ShowLabels!=nil{
c.Flags().BoolVar(f.ShowLabels,"show-labels",*f.ShowLabels,"When printing, show all labels as the last column (default hide labels column)")
}
iff.SortBy!=nil{
c.Flags().StringVar(f.SortBy,"sort-by",*f.SortBy,"If non-empty, sort list types using this field specification. The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath expression must be an integer or a string.")
}
iff.ColumnLabels!=nil{
c.Flags().StringSliceVarP(f.ColumnLabels,"label-columns","L",*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...")
}
iff.ShowKind!=nil{
c.Flags().BoolVar(f.ShowKind,"show-kind",*f.ShowKind,"If present, list the resource type for the requested object(s).")
}
}
// NewHumanPrintFlags returns flags associated with
// human-readable printing, with default values set.