Documentation ¶
Index ¶
- Constants
- Variables
- func AddOutputFlag(cmd *cobra.Command, varRef *Format)
- func AddOutputFlagForCreate(cmd *cobra.Command, varRef *Format, persistent bool)
- func Alert(out io.Writer, format string, i ...interface{})
- func BoldGreen(msg interface{}) string
- func BoldRed(msg interface{}) string
- func BoldYellow(msg interface{}) string
- func FatalWithRedColor(msg string, code int)
- func Formats() []string
- func FormatsWithDesc() map[string]string
- func PrettyPrintObj(obj *unstructured.Unstructured) error
- func PrintAllWarningEvents(events *corev1.EventList, out io.Writer)
- func PrintBlankLine(out io.Writer)
- func PrintComponentConfigMeta(tplInfos []types.ConfigTemplateInfo, clusterName, componentName string, ...)
- func PrintConditions(conditions []metav1.Condition, out io.Writer)
- func PrintHelmValues(configs map[string]interface{}, format Format, out io.Writer)
- func PrintLine(line string)
- func PrintLineWithTabSeparator(ps ...Pair)
- func PrintPairStringToLine(name, value string, spaceCount ...int)
- func PrintTable(out io.Writer, customSettings func(*TablePrinter), ...) error
- func PrintTitle(title string)
- func Warning(out io.Writer, format string, i ...interface{})
- type Format
- type Pair
- type TablePrinter
Constants ¶
const NoneString = "<none>"
Variables ¶
var ( // KubeCtlStyle renders a Table like kubectl KubeCtlStyle table.Style // TerminalStyle renders a Table like below: // +-----+------------+-----------+--------+-----------------------------+ // | # | FIRST NAME | LAST NAME | SALARY | | // +-----+------------+-----------+--------+-----------------------------+ // | 1 | Arya | Stark | 3000 | | // | 20 | Jon | Snow | 2000 | You know nothing, Jon Snow! | // | 300 | Tyrion | Lannister | 5000 | | // +-----+------------+-----------+--------+-----------------------------+ // | | | TOTAL | 10000 | | // +-----+------------+-----------+--------+-----------------------------+ TerminalStyle = table.Style{ Name: "TerminalStyle", Box: table.StyleBoxDefault, Color: table.ColorOptionsDefault, Format: table.FormatOptionsDefault, HTML: table.DefaultHTMLOptions, Options: table.OptionsDefault, Title: table.TitleOptionsDefault, } )
var ErrInvalidFormatType = fmt.Errorf("invalid format type")
Functions ¶
func AddOutputFlag ¶
func AddOutputFlagForCreate ¶
func BoldGreen ¶
func BoldGreen(msg interface{}) string
BoldGreen returns a string formatted with green and bold.
func BoldRed ¶
func BoldRed(msg interface{}) string
BoldRed returns a string formatted with red and bold.
func BoldYellow ¶
func BoldYellow(msg interface{}) string
BoldYellow returns a string formatted with yellow and bold.
func FatalWithRedColor ¶
FatalWithRedColor when an error occurs, sets the red color to print it.
func FormatsWithDesc ¶
func PrettyPrintObj ¶
func PrettyPrintObj(obj *unstructured.Unstructured) error
func PrintComponentConfigMeta ¶
func PrintComponentConfigMeta(tplInfos []types.ConfigTemplateInfo, clusterName, componentName string, out io.Writer)
PrintComponentConfigMeta prints the conditions of resource.
func PrintConditions ¶
PrintConditions prints the conditions of resource.
func PrintHelmValues ¶
PrintHelmValues prints the helm values file of the release in specified format, supports JSON、YAML and Table
func PrintLineWithTabSeparator ¶
func PrintLineWithTabSeparator(ps ...Pair)
func PrintPairStringToLine ¶
PrintPairStringToLine prints pair string for a line , the format is as follows "<space>*<key>:\t<value>". spaceCount is the space character count which is placed in the offset of field string. the default values of tabCount is 2.
func PrintTable ¶
func PrintTable(out io.Writer, customSettings func(*TablePrinter), rowFeeder func(*TablePrinter) error, header ...interface{}) error
PrintTable high level wrapper function.
func PrintTitle ¶
func PrintTitle(title string)
Types ¶
type Format ¶
type Format string
Format is a type for capturing supported output formats
func ParseFormat ¶
func (Format) IsHumanReadable ¶
type TablePrinter ¶
func NewTablePrinter ¶
func NewTablePrinter(out io.Writer) *TablePrinter
func (*TablePrinter) AddRow ¶
func (t *TablePrinter) AddRow(row ...interface{})
func (*TablePrinter) Print ¶
func (t *TablePrinter) Print()
func (*TablePrinter) SetHeader ¶
func (t *TablePrinter) SetHeader(header ...interface{})
func (*TablePrinter) SetStyle ¶
func (t *TablePrinter) SetStyle(style table.Style)
func (*TablePrinter) SortBy ¶
func (t *TablePrinter) SortBy(columnNumber ...int)
SortBy sorts the table alphabetically by the column you specify, it will be sorted by the first table column in default. The columnNumber index starts from 1