tableprinter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Border

func Border(left, mid, right string, widths []int) string

Border renders a horizontal border row, e.g. ┌───┬───┐

func CellWidth

func CellWidth(s string) int

CellWidth returns the terminal display width of s.

func Row

func Row(cells []Cell, widths []int) string

Row renders a data row with │ separators. Each cell is fitted to its column width first; then the optional ColorFn is applied to the fitted text.

Types

type Cell

type Cell struct {
	Text    string
	ColorFn func(string) string
}

Cell holds the text content of a table cell and an optional color function applied after the text is fitted to the column width.

func Colored

func Colored(text string, fn func(string) string) Cell

Colored returns a Cell whose fitted text is passed through fn before rendering.

func Plain

func Plain(text string) Cell

Plain returns a Cell with no color.

Jump to

Keyboard shortcuts

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