Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseOutputToTemplateTypeAndElement ¶
ParseOutputToTemplateTypeAndElement parses the output into templateType and templateElement e.g. kcp runtimes -o custom="INSTANCE ID:instanceID,SHOOTNAME:shootName" After parsing, the templateType = "custom" and templateElement = "INSTANCE ID:instanceID,SHOOTNAME:shootName"
func RelaxedJSONPathExpression ¶
RelaxedJSONPathExpression attempts to be flexible with JSONPath expressions, it accepts:
- metadata.name (no leading '.' or curly braces '{...}'
- {metadata.name} (no leading '.')
- .metadata.name (no curly braces '{...}')
- {.metadata.name} (complete expression)
And transforms them all into a valid jsonpath expression:
{.metadata.name}
Types ¶
type Column ¶
type Column struct { Header string // FieldSpec is a JSONPath expression which specifies the field(s) to be printed FieldSpec string // FieldFormatter is a formatter fuction to print complex columns derived from object field(s). FieldFormatter FieldFormatterFunc // contains filtered or unexported fields }
Column represents a user specified column. If FieldFormatter is not nil, it takes precedence over FieldSpec
func ParseColumnToHeaderAndFieldSpec ¶
ParseColumnToHeaderAndFieldSpec parses a custom columns contents to a list of Column <header>:<jsonpath-field-spec> pairs. e.g. spec is INSTANCE ID:instanceID,SHOOTNAME:shootName columnsOut[0].Header = "INSTANCE ID" and columnsOut[0].FieldSpec = "{.instanceID}" columnsOut[1].Header = "SHOOTNAME" and columnsOut[1].FieldSpec = "{.shootName}"
type FieldFormatterFunc ¶
type FieldFormatterFunc func(obj interface{}) string
FieldFormatterFunc is a function type to format and return the string representation of an object field.
type JSONPrinter ¶
type JSONPrinter interface {
PrintObj(obj interface{}) error
}
JSONPrinter prints objects in JSON format
func NewJSONPrinter ¶
func NewJSONPrinter(indent string) JSONPrinter
NewJSONPrinter creates a new JSONPrinter. If indent is set to a non-empty string, the output will be pretty-printed, and the specified string will be applied for each level of indentation.
type TablePrinter ¶
type TablePrinter interface { PrintObj(obj interface{}) error SetRuntimeEvents(eventList []events.EventDTO, lvl string) }
TablePrinter prints objects in table format, according to the given column definitions.
func NewTablePrinter ¶
func NewTablePrinter(columns []Column, noHeaders bool) (TablePrinter, error)
NewTablePrinter creates a new TablePrinter. The parameter columns holds the non-empty list of Column specifications which comprises the table. If the parameter noHeaders is true, the first header row will not be displayed.