console

package
v2.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

func NewConsole(w io.Writer, tableOptions *TableOptions, header func([]string) []byte) *Console

NewConsole create a new console writer

func (*Console) IsCSV

func (c *Console) IsCSV() bool

IsCSV return true if csv output is set

func (*Console) IsJSON

func (c *Console) IsJSON() bool

IsJSON return true if JSON output is set

func (*Console) IsJSONStream

func (c *Console) IsJSONStream() bool

IsJSONStream check if json stream mode is activated

func (*Console) IsTable

func (c *Console) IsTable() bool

IsTable return true if table output is set

func (*Console) Printf

func (c *Console) Printf(format string, a ...interface{}) (int, error)

Printf mimics fmt.Printf

func (*Console) Println

func (c *Console) Println(a ...interface{}) (int, error)

Println mimics fmt.Println

func (*Console) SetHeaderFromInput

func (c *Console) SetHeaderFromInput(input string)

func (*Console) WithCSVHeader

func (c *Console) WithCSVHeader() bool

WithCSVHeader returns true if the csv output should include a header

func (*Console) Write

func (c *Console) Write(b []byte) (n int, err error)

Write a line to the output. Supports concurrent access

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
}

TableOptions table options to control the column behaviour

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL