table

package
v0.12.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFormat = FormatTable

DefaultFormat is the default format for output. It is a table.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format added in v0.12.0

type Format int

Format is the output format.

const (
	// FormatTable prints a table.
	FormatTable Format = iota
	// FormatJSON prints JSON.
	FormatJSON
)

func DetectFormat added in v0.12.0

func DetectFormat(formatName string) (Format, error)

DetectFormat detects a format from a string.

type Table

type Table struct {
	Name   string
	Format Format
	// contains filtered or unexported fields
}

Table creates an output table. Use the New constructor to ensure defaults are set properly.

func New

func New(name string, w io.Writer) *Table

New creates an instance of table.

func (*Table) Append

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

Append appends a row to the table.

func (*Table) AppendBulk

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

AppendBulk appends multiple rows to the table.

func (*Table) Render

func (t *Table) Render() error

Render writes the output to the table's writer.

func (*Table) SetFormat added in v0.12.0

func (t *Table) SetFormat(f Format)

SetFormat sets sets the output format.

func (*Table) SetHeader

func (t *Table) SetHeader(columns []string)

SetHeader sets the header for the table.

Jump to

Keyboard shortcuts

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