package texttab
import "golang.org/x/perf/cmd/benchstat/internal/texttab"
Index ¶
- Variables
- type CellOption
- type Table
- func (t *Table) Cell(value string, opts ...CellOption) *Table
- func (t *Table) Col(col int) *Table
- func (t *Table) CurCol() int
- func (t *Table) Format(w io.Writer) error
- func (t *Table) Row() *Table
- func (t *Table) SetShrink(col int, shrink bool)
- func (t *Table) Span(cols int, value string, opts ...CellOption) *Table
Variables ¶
var ( Left CellOption = func(c *textCell) { c.alignment = alignLeft } Center = func(c *textCell) { c.alignment = alignCenter } Right = func(c *textCell) { c.alignment = alignRight } )
Types ¶
type CellOption ¶
type CellOption func(c *textCell)
func LeftMargin ¶
func LeftMargin(x string) CellOption
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table does layout of text-based tables.
Many of its methods return the textTable so callers can easily chain them to build up many cells at once.
func (*Table) Cell ¶
func (t *Table) Cell(value string, opts ...CellOption) *Table
Cell adds a single-column cell at the current row and column.
func (*Table) Col ¶
Col skips to column "col" in table t. Columns are numbered starting at 0.
func (*Table) CurCol ¶
CurCol returns the current column index.
func (*Table) Format ¶
Format lays out table t and writes it to w.
func (*Table) Row ¶
Row starts a new row in table t.
func (*Table) SetShrink ¶
SetShrink marks a column as a "shrink" column, which will have minimum width.
func (*Table) Span ¶
func (t *Table) Span(cols int, value string, opts ...CellOption) *Table
Span adds a multi-column cell at the current row and column.
Source Files ¶
table.go
- Version
- v0.0.0-20250214215153-c95ad7d5b636 (latest)
- Published
- Feb 14, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 week ago –
Tools for package owners.