table

package
v0.0.0-...-b69a640 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//AlignLeft aligns text left
	AlignLeft uint = 1 << iota
	//AlignRight aligns text right
	AlignRight
	//AlignCenter aligns text center
	AlignCenter
	//CenterHeader aligns first row center
	CenterHeader
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute int

Attribute holds an int for formatting

const (
	Reset Attribute = iota
	Bold
	Faint
	Italic
	Underline
	BlinkSlow
	BlinkRapid
	ReverseVideo
	Concealed
	CrossedOut
)

Base attributes

const (
	FgBlack Attribute = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)

Foreground text colors

const (
	FgHiBlack Attribute = iota + 90
	FgHiRed
	FgHiGreen
	FgHiYellow
	FgHiBlue
	FgHiMagenta
	FgHiCyan
	FgHiWhite
)

Foreground Hi-Intensity text colors

const (
	BgBlack Attribute = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
)

Background text colors

const (
	BgHiBlack Attribute = iota + 100
	BgHiRed
	BgHiGreen
	BgHiYellow
	BgHiBlue
	BgHiMagenta
	BgHiCyan
	BgHiWhite
)

Background Hi-Intensity text colors

type Column

type Column struct {
	Text   string
	Format []Attribute
}

Column holds an column

type Row

type Row struct {
	Columns []*Column
}

Row holds a row with columns

type Table

type Table struct {
	Rows      []*Row
	Padding   int
	PadChar   string
	Alignment []uint
}

Table holds a table

func InitTable

func InitTable(padding int, padChar string, alignment []uint) *Table

InitTable returns a Table with alignment set

func (*Table) AddRow

func (t *Table) AddRow(c []*Column)

func (*Table) AddRowStrings

func (t *Table) AddRowStrings(s []string)

func (*Table) Print

func (t *Table) Print(w io.Writer)

Jump to

Keyboard shortcuts

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