Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseTablePrinter ¶
type BaseTablePrinter struct { IOStreams genericclioptions.IOStreams Columns []ColumnDefinition }
BaseTablePrinter provides functionality for printing information about a set of resources into a table format. The printer will print to the Out stream defined in IOStreams, and will print into the format defined by the Column definitions.
func (*BaseTablePrinter) PrintTable ¶
func (t *BaseTablePrinter) PrintTable(rs ResourceStates, moveUpCount int) int
PrintTable prints the resources defined in ResourceStates. It will print subresources if they exist. moveUpCount defines how many lines the printer should move up before starting printing. The return value is how many lines were printed.
type ColumnDef ¶
type ColumnDef struct { ColumnName string ColumnHeader string ColumnWidth int PrintResourceFunc func(w io.Writer, width int, r Resource) (int, error) }
ColumnDef is an implementation of the ColumnDefinition interface. It can be used to define simple columns that doesn't need additional knowledge about the actual type of the provided Resource besides the information available through the interface.
func MustColumn ¶
MustColumn returns the pre-defined column definition with the provided name. If the name doesn't exist, it will panic.
func (ColumnDef) PrintResource ¶
PrintResource is called by the BaseTablePrinter to output the content of a particular column. This implementation just delegates to the provided PrintResourceFunc.
type ColumnDefinition ¶
type ColumnDefinition interface { Name() string Header() string Width() int PrintResource(w io.Writer, width int, r Resource) (int, error) }
ColumnDefinition defines the columns that should be printed.
type Resource ¶
type Resource interface { Identifier() object.ObjMetadata ResourceStatus() *pe.ResourceStatus SubResources() []Resource }
Resource defines the interface that each of the Resource objects must implement.
type ResourceStates ¶
ResourceStates defines the interface that must be implemented by the object that provides information about the resources that should be printed.