texttable

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotCellProperties = errors.New("texttable: dimensions-set: not given a cell")

Functions

func CellPropertyExtractDimensions

func CellPropertyExtractDimensions(cell *tabular.Cell) dimensions

func CellPropertyExtractLinesWidths

func CellPropertyExtractLinesWidths(cell *tabular.Cell) []decoration.WidthString

func Render

func Render(t tabular.Table) (string, error)

Render takes a tabular.Table and creates a default options TextTable object and then calls the Render method upon it.

func RenderTo

func RenderTo(t tabular.Table, w io.Writer) error

RenderTo takes a tabular.Table and creates a default options TextTable object and then calls the RenderTo method upon it.

Types

type TextTable

type TextTable struct {
	tabular.Table
	// contains filtered or unexported fields
}

A TextTable wraps a tabular.Table to act as the render control for tabular output to a fixed-cell grid system such as a terminal emulator (in the Unix TTY model).

func New

func New() *TextTable

New returns a TextTable with a new tabular.Table inside it.

func Wrap

func Wrap(t tabular.Table) *TextTable

Wrap returns a TextTable rendering object for the given tabular.Table

func (*TextTable) Render

func (t *TextTable) Render() (string, error)

Render returns a string representing the fully rendered table, or an error.

func (*TextTable) RenderTo

func (t *TextTable) RenderTo(w io.Writer) error

RenderTo writes the TextTable to the provided writer, stopping if it encounters an error.

func (*TextTable) RowToLinesOfWidthStrings

func (t *TextTable) RowToLinesOfWidthStrings(
	cells []tabular.Cell,
	columnCount int,
) [][]decoration.WidthString

func (*TextTable) SetDecoration

func (t *TextTable) SetDecoration(decor decoration.Decoration) *TextTable

SetDecoration sets a Decoration type for rendering a table. The caller must provide the decoration object.

func (*TextTable) SetDecorationNamed

func (t *TextTable) SetDecorationNamed(n string) (*TextTable, error)

SetDecorationNamed selects a decoration by name, from the decoration package. It returns an error if the name is not known. If the name is not known, this is still registered in the TextTable, so that later attempts to render it will fail, instead of succeeding with unexpected output.

Directories

Path Synopsis
The decoration package provides controls for how text tables are decorated for rendering.
The decoration package provides controls for how text tables are decorated for rendering.

Jump to

Keyboard shortcuts

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