printutil

package
v0.8.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

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

	// RowSelectionPrompt puts a number in front of each row and prompts user for selection
	GetUserInput bool

	// 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

	DynamicPadding bool
	// contains filtered or unexported fields
}

Table represents a table to be printed

func (*Table) AddRow

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

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

func (*Table) GetPadding

func (t *Table) GetPadding(padding []int) 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