console

package
v2.54.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) IsTextOutput added in v2.30.0

func (c *Console) IsTextOutput() bool

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) SetOut added in v2.52.2

func (c *Console) SetOut(w io.Writer)

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

	// NumberFormatter formatting used when rendering numbers
	NumberFormatter numbers.NumberFormatter
}

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