tableprinter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WithColor    = tableprinter.WithColor
	WithPadding  = tableprinter.WithPadding
	WithTruncate = tableprinter.WithTruncate
)
View Source
var NoHeader = headerOption{}

NoHeader disable printing or checking for a table header.

Deprecated: use WithHeader unless required otherwise.

Functions

func WithHeader

func WithHeader(columns ...string) headerOption

WithHeader defines the column names for a table. Panics if columns is nil or empty.

Types

type TablePrinter

type TablePrinter struct {
	tableprinter.TablePrinter
	// contains filtered or unexported fields
}

func New

func New(ios *iostreams.IOStreams, headers headerOption) *TablePrinter

New creates a TablePrinter from an IOStreams.

func NewWithWriter

func NewWithWriter(w io.Writer, isTTY bool, maxWidth int, cs *iostreams.ColorScheme, headers headerOption) *TablePrinter

NewWithWriter creates a TablePrinter from a Writer, whether the output is a terminal, the terminal width, and more.

func (*TablePrinter) AddTimeField

func (tp *TablePrinter) AddTimeField(now, t time.Time, c func(string) string)

AddTimeField in TTY mode displays the fuzzy time difference between now and t. In non-TTY mode it just displays t with the time.RFC3339 format.

func (*TablePrinter) IsTTY

func (t *TablePrinter) IsTTY() bool

IsTTY gets whether the TablePrinter will render to a terminal.

Jump to

Keyboard shortcuts

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