texttab

package
v0.0.0-...-02a15fd Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Left   CellOption = func(c *textCell) { c.alignment = alignLeft }
	Center            = func(c *textCell) { c.alignment = alignCenter }
	Right             = func(c *textCell) { c.alignment = alignRight }
)

Functions

This section is empty.

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

func (t *Table) Col(col int) *Table

Col skips to column "col" in table t. Columns are numbered starting at 0.

func (*Table) CurCol

func (t *Table) CurCol() int

CurCol returns the current column index.

func (*Table) Format

func (t *Table) Format(w io.Writer) error

Format lays out table t and writes it to w.

func (*Table) Row

func (t *Table) Row() *Table

Row starts a new row in table t.

func (*Table) SetShrink

func (t *Table) SetShrink(col int, shrink bool)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳