table

package
v6.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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