table

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment int

Alignment represents text alignment in a table column

const (
	AlignLeft Alignment = iota
	AlignRight
	AlignCenter
)

type Table

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

Table represents a simple ASCII table

func NewTable

func NewTable(writer io.Writer) *Table

NewTable creates a new table that will write to the given writer

func (*Table) Append

func (t *Table) Append(row []string)

Append adds a row to the table

func (*Table) Render

func (t *Table) Render()

Render draws the table to the writer

func (*Table) WithColumnAlignment

func (t *Table) WithColumnAlignment(alignment []Alignment) *Table

WithColumnAlignment sets the alignment for each column

func (*Table) WithHeader

func (t *Table) WithHeader(header []string) *Table

WithHeader sets the table header

func (*Table) WithHeaderAlignment

func (t *Table) WithHeaderAlignment(alignment []Alignment) *Table

WithHeaderAlignment sets specific alignment for headers, separate from column content

func (*Table) WithRows

func (t *Table) WithRows(rows [][]string) *Table

WithRows sets the rows of the table

Jump to

Keyboard shortcuts

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