Documentation ¶
Index ¶
- Constants
- Variables
- func AddOutputFlag(cmd *cobra.Command, varRef *Format)
- func AddOutputFlagForCreate(cmd *cobra.Command, varRef *Format)
- 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 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 ¶ added in v0.6.0
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 ¶ added in v0.6.0
FatalWithRedColor when an error occurs, set the red color to print it.
func FormatsWithDesc ¶
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 ¶ added in v0.6.0
PrintHelmValues print the helm values file of the release in specified format, support JSON、YAML and Table
func PrintLineWithTabSeparator ¶
func PrintLineWithTabSeparator(ps ...Pair)
func PrintPairStringToLine ¶
PrintPairStringToLine print 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 ¶ added in v0.6.0
func (t *TablePrinter) SortBy(columnNumber ...int)
SortBy will sort the table alphabetically by the column you specify, it will be sorted by the first table column in default. The columnNumber index start from 1