Documentation ¶
Index ¶
- Variables
- func GetAllOutputFormatStrings() []string
- func GetPrinter(output OutputFormat) (printers.ResourcePrinter, error)
- func MaybeAppendTimeAgo(kvs [][]string, key string, t *metav1.Time) [][]string
- func PrintObject(gvk schema.GroupVersionKind, output OutputFormat, out io.Writer, object Object) error
- func PrintObjects(gvk schema.GroupVersionKind, output OutputFormat, out io.Writer, objs []Object) error
- type DescriptionPrinter
- type NamePrinter
- type Object
- type OutputFormat
- type Section
- type SectionGenerator
- type TablePrinter
Constants ¶
This section is empty.
Variables ¶
var AllOutputFormats = []OutputFormat{ OutputFormatPretty, OutputFormatDetail, OutputFormatName, OutputFormatJSON, OutputFormatYAML, }
AllOutputFormats is a list of all possible output formats.
Functions ¶
func GetAllOutputFormatStrings ¶
func GetAllOutputFormatStrings() []string
GetAllOutputFormatStrings returns a list of all possible output formats as a slice of strings.
func GetPrinter ¶
func GetPrinter(output OutputFormat) (printers.ResourcePrinter, error)
GetPrinter returns the ResourcePrinter associated with output. Most implementations are taken from cli-runtime itself, so we don't need to really implement too much.
func MaybeAppendTimeAgo ¶
MaybeAppendTimeAgo is a helper that appends a key-value description pair to kvs if t is non-zero, formatted as a time with relative duration from now.
func PrintObject ¶
func PrintObject(gvk schema.GroupVersionKind, output OutputFormat, out io.Writer, object Object) error
PrintObject will print a single object using the printer corresponding to the specified output format.
func PrintObjects ¶
func PrintObjects(gvk schema.GroupVersionKind, output OutputFormat, out io.Writer, objs []Object) error
PrintObjects takes the list of items and converts it to a single List, before printing it with PrintObject.
Types ¶
type DescriptionPrinter ¶
type DescriptionPrinter struct {
// contains filtered or unexported fields
}
DescriptionPrinter prints key-value pairs, separated by sections.
func NewDescriptionPrinter ¶
func NewDescriptionPrinter(out io.Writer) *DescriptionPrinter
func (*DescriptionPrinter) Descriptions ¶
func (p *DescriptionPrinter) Descriptions(kvs [][]string)
func (*DescriptionPrinter) Divider ¶
func (p *DescriptionPrinter) Divider()
func (*DescriptionPrinter) Header ¶
func (p *DescriptionPrinter) Header(header string)
func (*DescriptionPrinter) NewLine ¶
func (p *DescriptionPrinter) NewLine()
func (*DescriptionPrinter) Print ¶
func (p *DescriptionPrinter) Print(kvs [][]string)
Print prints each of the given key-value pairs.
type NamePrinter ¶
type NamePrinter struct {
// contains filtered or unexported fields
}
NamePrinter is an implementation of ResourcePrinter which outputs "resource/name" pair of an object. This printer extends the default printers.NamePrinter to work with lists by assuming that all items have a GroupVersionKind already set.
func NewNamePrinter ¶
func NewNamePrinter() *NamePrinter
type Object ¶
type Object interface { schema.ObjectKind runtime.Object }
Object is a runtime object that also has a Kind.
type OutputFormat ¶
type OutputFormat string
OutputFormat specifies a format to print output.
const ( OutputFormatPretty OutputFormat = "pretty" OutputFormatDetail OutputFormat = "detail" OutputFormatName OutputFormat = "name" OutputFormatJSON OutputFormat = "json" OutputFormatYAML OutputFormat = "yaml" )
func (OutputFormat) IsValid ¶
func (f OutputFormat) IsValid() bool
type SectionGenerator ¶
func ToSectionGenerator ¶
func ToSectionGenerator(section Section) SectionGenerator
ToSectionGenerator converts a Section into a SectionGenerator.
type TablePrinter ¶
type TablePrinter struct {
// contains filtered or unexported fields
}
TablePrinter prints tables with header and body rows. TODO(irvinlim): Maybe we could use printers.TablePrinter instead of rolling our own.
func NewTablePrinter ¶
func NewTablePrinter(out io.Writer) *TablePrinter
func (*TablePrinter) Print ¶
func (p *TablePrinter) Print(header []string, rows [][]string)
Print the header and each row to standard output.