table

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 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 renders tables for termtable: a grid family (unicode, rounded, ascii, markdown) and borderless padded columns. All of it is written for this module, with no third-party table code and no attribution requirements. It is internal, so only the termtable style api is public.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Bordered draws a full unicode box.
	Bordered = GridConfig{Top: true, Bottom: true, RowLines: true, /* contains filtered or unexported fields */}
	// Rounded is Bordered with rounded corners.
	Rounded = GridConfig{Top: true, Bottom: true, RowLines: true, /* contains filtered or unexported fields */}
	// ASCII is Bordered with plain ascii pieces.
	ASCII = GridConfig{Top: true, Bottom: true, RowLines: true, /* contains filtered or unexported fields */}
	// Markdown draws a pipe table with a header rule, for docs.
	Markdown = GridConfig{HeaderLeft: true, /* contains filtered or unexported fields */}
)

Grid presets.

Functions

func Grid

func Grid(w io.Writer, cfg GridConfig, header []string, rows [][]string) error

Grid writes header and rows as a grid table. Cells wrap to their contents unless the table outgrows the writer's width: os.Stdout measures the terminal, anything else assumes eighty columns, and oversized cells then wrap at word boundaries with hyphens.

func Plain

func Plain(w io.Writer, header []string, rows [][]string) error

Plain writes header and rows as padded columns with no borders, the shape scripts read best. Every cell widens its column to the longest visible value plus padding, so ansi-styled cells stay aligned, and multi-line cells split into extra physical rows.

Types

type GridConfig

type GridConfig struct {
	Top        bool // draw the outer top border
	Bottom     bool // draw the outer bottom border
	RowLines   bool // draw rules between data rows
	HeaderLeft bool // left-align headers instead of centering
	// contains filtered or unexported fields
}

GridConfig selects a grid look.

Jump to

Keyboard shortcuts

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