table

package
v3.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ALIGN_LEFT   = 0
	ALIGN_CENTER = 1
	ALIGN_RIGHT  = 2
)

Variables

This section is empty.

Functions

func Pad

func Pad(s, pad string, width int, align int) string

func PadCenter

func PadCenter(s, pad string, width int) string

func PadLeft

func PadLeft(s, pad string, width int) string

func PadRight

func PadRight(s, pad string, width int) string

Types

type Table

type Table struct {
	Out          io.Writer
	Rows         [][]string
	ColumnWidths []int
	ColumnAlign  []int
	Separator    string
}

func CreateTable

func CreateTable(out io.Writer) Table

func (*Table) AddRow

func (t *Table) AddRow(col ...string)

AddRow adds a new row to the table

func (*Table) Clear

func (t *Table) Clear()

Clear removes all rows while preserving the layout

func (*Table) GetColumnAlign

func (t *Table) GetColumnAlign(i int) int

GetColumnAlign return the column alignment

func (*Table) Render

func (t *Table) Render()

func (*Table) SetColumnAlign

func (t *Table) SetColumnAlign(i int, align int)

SetColumnAlign sets the column alignment for the given column index

func (*Table) SetColumnsAligns

func (t *Table) SetColumnsAligns(colAligns []int)

SetColumnsAligns sets the alignment of the columns

Jump to

Keyboard shortcuts

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