table

package
v0.0.0-...-6719cd2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package table formats data into a text-based table for human consumption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrettyPrint

func PrettyPrint(dest io.Writer, t [][]string, opts Options)

PrettyPrint writes 't' as a nicely formatted table to the supplied Writer.

if HeaderRow / FooterRow options are specified then a divider will be added between the header and/or footer rows. Cells are allowed to be multi-line, use \n as a line break. If no Justify option is used, the default is to left justify.

Types

type Options

type Options int

Options represents different ways to control how the table is generated

const (
	// HeaderRow if specified will format the first row in the table
	// as a header (i.e. there is a separator between it and the next row)
	HeaderRow Options = 1 << iota
	// FooterRow if specified will format the last row of the table
	// as a footer (i.e. there is a separator between it and the previous row)
	FooterRow
	// SkipEmpty if specified will cause nothing to be generated in the case
	// that the table has no data (i.e. no rows besides the header & footer rows
	// if they are enabled)
	SkipEmpty
	// RightJustify indicates that cells should have their contents right
	// justified (left padded), rather than the default of left justified.
	RightJustify
)

Jump to

Keyboard shortcuts

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