Documentation
¶
Index ¶
- Constants
- type Console
- func (c *Console) Flush()
- func (c *Console) IsCSV() bool
- func (c *Console) IsJSON() bool
- func (c *Console) IsJSONStream() bool
- func (c *Console) IsTable() bool
- func (c *Console) IsTextOutput() bool
- func (c *Console) Printf(format string, a ...interface{}) (int, error)
- func (c *Console) Println(a ...interface{}) (int, error)
- func (c *Console) SetHeaderFromInput(input string, groups []jsonfilter.KeyGroup)
- func (c *Console) SetOut(w io.Writer)
- func (c *Console) WithCSVHeader() bool
- func (c *Console) Write(b []byte) (n int, err error)
- type TableOptions
Constants ¶
const DefaultSampleSize = 5
DefaultSampleSize maximum number of rows sampled when resolving table columns
const DefaultTableFlushTimeout = 500 * time.Millisecond
DefaultTableFlushTimeout maximum time the first table rows are buffered while waiting for more rows to be sampled, so long-running streams (e.g. realtime subscriptions) are not delayed indefinitely
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Console ¶
type Console struct {
Colorized bool
Compact bool
Disabled bool
Format config.OutputFormat
TableViewer *tableviewer.TableView
// contains filtered or unexported fields
}
Console thread safe way to write to an output
func NewConsole ¶
NewConsole create a new console writer
func (*Console) Flush ¶ added in v2.55.0
func (c *Console) Flush()
Flush render any buffered table output. It should be called once no more output is expected (e.g. at the end of a command)
func (*Console) IsJSONStream ¶
IsJSONStream check if json stream mode is activated
func (*Console) IsTextOutput ¶ added in v2.30.0
func (*Console) SetHeaderFromInput ¶
func (c *Console) SetHeaderFromInput(input string, groups []jsonfilter.KeyGroup)
func (*Console) WithCSVHeader ¶
WithCSVHeader returns true if the csv output should include a header
type TableOptions ¶
type TableOptions struct {
// MinColumnWidth minimum column width
MinColumnWidth int
// MinEmptyValueColumnWidth minimum column width to use when the value is empty
// If set to 0, then the MinColumnWidth will be used
MinEmptyValueColumnWidth int
// MaxColumnWidth maximum column width
MaxColumnWidth int
// ColumnPadding column padding
ColumnPadding int
// Row mode (truncate or wrap)
RowMode string
// NumberFormatter formatting used when rendering numbers
NumberFormatter numbers.NumberFormatter
// SampleSize maximum number of rows which are sampled when resolving
// the table columns and column widths. If set to 0, then a default value will be used
SampleSize int
// SampleTimeout maximum duration to buffer rows whilst waiting for more rows
// to be sampled, so that streamed output is not delayed indefinitely.
// If set to 0, then buffered rows are only rendered once the sample size is
// reached or no more output is expected
SampleTimeout time.Duration
}
TableOptions table options to control the column behaviour