Documentation
¶
Overview ¶
Package table provides a terminal table renderer backed by lipgloss. Consumers supply data via the TableData interface rather than building lipgloss tables directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatCell ¶
FormatCell converts a value to a display string for a table cell. It handles nil, empty strings, zero values, time formatting, and Bold wrapping.
func Render ¶
Render renders the table data as a string suitable for terminal output. Columns are auto-sized to the terminal width with word wrapping enabled.
func RenderMarkdown ¶
RenderMarkdown renders the table data as a Markdown table string, suitable for platforms that render markdown (Telegram, terminal with glamour).
Types ¶
type Bold ¶
type Bold struct{ Value any }
Bold wraps a cell value so that FormatCell renders it in bold.
type TableData ¶
type TableData interface {
// Header returns the column header labels.
Header() []string
// Len returns the number of rows.
Len() int
// Row returns the cell values for row i. Values are converted to
// strings via FormatCell. Return nil to skip a row.
// Wrap a value in Bold{} to render it in bold.
Row(i int) []any
}
TableData is the interface that data sources implement to be rendered as a terminal table.