Documentation ¶
Index ¶
Constants ¶
const ( // RESET is the escape sequence for unsetting any previous commands. RESET = 0 // ESC is the escape sequence used to send ANSI commands in the terminal. ESC = 27 )
Variables ¶
This section is empty.
Functions ¶
func FormatFn ¶
FormatFn is a wrapper of a function of specific type to a function of interface{}. It acts as an adapter to allow using the function with the Column.FormatFn.
func SprintfWithColor ¶
SprintfWithColor formats according to the provided pattern and returns the result as a string with the necessary ansii escape codes for color
Types ¶
type Column ¶
type Column struct { Header string Width int MaxLineWrap int // Maximum number of lines to wrap the content to. WrapPrefix string FormatFn func(obj interface{}) string }
Column defines a column in a table.
type PeriodicPrinter ¶
type PeriodicPrinter struct {
// contains filtered or unexported fields
}
PeriodicPrinter prints status updates to the terminal, as they arrive to the update channel. It tracks the number of lines printed and clears the screen before printing the next update.
func NewPeriodicPrinter ¶
func NewPeriodicPrinter(printer StatusPrinter, updateChan <-chan eval.StatusUpdate, callback func([]status.ObjectStatus)) *PeriodicPrinter
func (*PeriodicPrinter) Start ¶
func (p *PeriodicPrinter) Start()
type PrintOptions ¶
type StatusPrinter ¶
type StatusPrinter interface { PrintStatuses(statuses []status.ObjectStatus) int PrintError(err error) int Printf(raw string, args ...interface{}) }
StatusPrinter is an interface for printing status updates.
type TablePrinter ¶
type TablePrinter struct { IOStreams genericclioptions.IOStreams PrintOpts PrintOptions }
TablePrinter implements StatusPrinter interface for printing the status of resources in a tabular format.
func NewTablePrinter ¶
func NewTablePrinter(ioStreams genericclioptions.IOStreams, opts PrintOptions) *TablePrinter
func (*TablePrinter) PrintError ¶
func (t *TablePrinter) PrintError(err error) int
func (*TablePrinter) PrintStatuses ¶
func (t *TablePrinter) PrintStatuses(objects []status.ObjectStatus) int
func (*TablePrinter) Printf ¶
func (t *TablePrinter) Printf(format string, a ...interface{})