table

package
v6.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package table prints tables laid out as console-table-printer did for the TypeScript CLI: box drawing, one space of padding, right-aligned unless a column says otherwise.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cell

func Cell(name string, value any) [2]string

Types

type Alignment

type Alignment int
const (
	Right Alignment = iota
	Left
)

type Color

type Color int
const (
	Default Color = iota
	Red
	Green
)

type Column

type Column struct {
	Name      string
	Title     string
	Alignment Alignment
}

type Table

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

func New

func New(columns ...Column) *Table

func (*Table) AddRow

func (t *Table) AddRow(color Color, cells ...[2]string)

AddRow adds a row. Without declared columns, they are taken from the row's keys in order, as console-table-printer did.

func (*Table) Print

func (t *Table) Print()

func (*Table) Render

func (t *Table) Render() string

Jump to

Keyboard shortcuts

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