tableprinter

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 5 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 TTY mode columns are padded to align and the last column is truncated to respect maxWidth; in non-TTY mode fields are tab-separated and headers are omitted.

Jump to

Keyboard shortcuts

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