Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TableConfig ¶
type TableConfig struct {
MaxLineWidth int
MaxColumnWidth int
// GetTerminalWidth takes precedence over MaxLineWidth if provided.
GetTerminalWidth TerminalWidthGetter
// IncludeHeader indicates whether the first line of data is a header.
IncludeHeader bool
// JSONTagsAsHeaders indicates whether to use struct `json` tags as the
// values for the header line. Implies IncludeHeader. Only used with
// Structs().
JSONTagsAsHeaders bool
// TimeAsDiffs causes time.Time fields to be converted to human-readable
// diffs from the current time.
TimeAsDiffs bool
// EmptyCollectionsBlank causes empty slices and maps to appear blank as
// opposed to "[]" or "map[]".
EmptyCollectionsBlank bool
}
TableConfig provides configuration for building textual tables.
func (TableConfig) MakeTable ¶
func (c TableConfig) MakeTable(data [][]string) string
MakeTable creates a textual table from the given data, which is presumed to be broken into rows of cells.
type TerminalWidthGetter ¶
type TerminalWidthGetter func() int
TerminalWidthGetter is a function which returns the width of the terminal.
func GetTerminalWidthFunc ¶
func GetTerminalWidthFunc(defaultWidth int) TerminalWidthGetter
GetTerminalWidthFunc returns a TerminalWidthGetter which finds the width of the terminal or returns the given default if not running in a terminal.
Click to show internal directories.
Click to hide internal directories.