printutil

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: Apache-2.0 Imports: 1 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Row

type Row struct {
	Raw      []string
	Rendered string
	Colored  bool
}

Row represents a row to be printed

type Table

type Table struct {
	// A slice of ints defining the padding for each column
	Padding         []int
	RenderedPadding string

	// Slice of strings representing column headers
	Header         []string
	RenderedHeader string

	// Truncate rows if they exceed padding length
	Truncate bool

	// An array of row structs
	Rows []Row

	// A message to print after table has been printed
	SuccessMsg string

	// Optional message to print if no rows were passed to table
	NoResultsMsg string

	// Len 2 array with elements representing ColorCode and ColorTrm respectively
	ColorRowCode [2]string
}

Table represents a table to be printed

func (*Table) AddRow

func (t *Table) AddRow(row []string, color bool)

AddRow is the preferred interface for adding a row to a table

func (*Table) GetPadding

func (t *Table) GetPadding() string

GetPadding converts an array of ints into template padding for str fmting

func (*Table) Print

func (t *Table) Print() error

Print header __as well as__ rows

func (*Table) PrintHeader

func (t *Table) PrintHeader()

PrintHeader prints header

func (*Table) PrintRows

func (t *Table) PrintRows()

PrintRows prints rows with an "S"

Jump to

Keyboard shortcuts

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