table

package
v0.35.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	// contains filtered or unexported fields
}

Cell represents a Table cell

func NewCell

func NewCell(text string, c *color.Color) *Cell

NewCell creates a new cell. Color can be nil.

func (*Cell) Justify

func (t *Cell) Justify(mode JustifyMode)

Justify sets text justification

func (*Cell) Len

func (t *Cell) Len() int

Len returns the size of the cell, taking into account color codes

func (*Cell) Pad

func (t *Cell) Pad(totalLen int) string

Pad sets the cell padding

type ColumnWidthMode

type ColumnWidthMode int

ColumnWidthMode is used to configure columns type

const (
	// Minimum FIXMEDOC
	Minimum ColumnWidthMode = iota
	// Average FIXMEDOC
	Average
)

type JustifyMode

type JustifyMode int

JustifyMode is used to configure text alignment on cells

const (
	JustifyLeft JustifyMode = iota
	JustifyCenter
	JustifyRight
)

Justify mode enumeration

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table represent a table that can be printed on a terminal

func New

func New() *Table

New creates an empty table

func (*Table) AddRow

func (t *Table) AddRow(columns ...interface{})

AddRow FIXMEDOC

func (*Table) Render

func (t *Table) Render() string

Render FIXMEDOC

func (*Table) SetColumnWidthMode

func (t *Table) SetColumnWidthMode(x int, mode ColumnWidthMode)

SetColumnWidthMode FIXMEDOC

func (*Table) SetHeader

func (t *Table) SetHeader(columns ...interface{})

SetHeader FIXMEDOC

Jump to

Keyboard shortcuts

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