printutil

package
v0.7.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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