tableprinter

package
v1.135.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TablePrinter

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

TablePrinter renders aligned tabular output.

func New

func New(w io.Writer, isTTY bool, maxWidth int) *TablePrinter

func (*TablePrinter) AddField

func (t *TablePrinter) AddField(s string)

func (*TablePrinter) AddHeader

func (t *TablePrinter) AddHeader(fields ...string)

AddHeader sets column headers. In TTY mode they are printed before data rows; in non-TTY mode they are suppressed so piped output stays machine-readable.

func (*TablePrinter) EndRow

func (t *TablePrinter) EndRow()

func (*TablePrinter) Render

func (t *TablePrinter) Render() error

Render writes all rows in the appropriate format (aligned columns for TTY, tab-separated for pipes). The last column is truncated to maxWidth in TTY mode.

Jump to

Keyboard shortcuts

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