terminal

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 36

Documentation

Index

Constants

View Source
const (
	TopSeparatorTableStyle = 1 << iota
	ColumnSeparatorTableStyle
	RowSeparatorTableStyle
	BottomSeparatorTableStyle
)
View Source
const IndentSpaces = 2

Variables

View Source
var Indent = strings.Repeat(" ", IndentSpaces)
View Source
var Quiet bool = false
View Source
var Stderr io.Writer = os.Stderr
View Source
var Stdout io.Writer = os.Stdout

Functions

func ColorError

func ColorError(name string) string

func ColorHeading

func ColorHeading(name string) string

func ColorName

func ColorName(name string) string

func ColorPath

func ColorPath(name string) string

func ColorTypeName

func ColorTypeName(name string) string

func ColorValue

func ColorValue(name string) string

func ColoredOptions

func ColoredOptions(options []string, colorizer Colorizer) string

func EnableColor

func EnableColor(force bool)

func GetSize added in v0.1.1

func GetSize() (int, int, error)

func IndentString

func IndentString(indent int) string

func Options

func Options(options []string) string

func PrintIndent

func PrintIndent(indent int)

func ProcessColorizeFlag

func ProcessColorizeFlag(colorize string) error

Types

type Colorizer

type Colorizer = func(name string) string

type Table

type Table struct {
	Rows     [][][]string
	Style    TableStyle
	MaxWidth int

	HeadingSeparator       string
	RowSeparator           string
	TopDividerSeparator    string
	TopDivider             string
	MiddleDividerSeparator string
	MiddleDivider          string
	BottomDividerSeparator string
	BottomDivider          string
}

func NewTable

func NewTable(width int, headings ...string) *Table

func (*Table) Add

func (self *Table) Add(cells ...string)

func (*Table) ColumnWidths

func (self *Table) ColumnWidths() (int, []int)

func (*Table) Print

func (self *Table) Print()

func (*Table) Wrap

func (self *Table) Wrap()

func (*Table) Write

func (self *Table) Write(writer io.Writer)

type TableStyle

type TableStyle uint8

type TreePrefix

type TreePrefix []bool

func (TreePrefix) Print

func (self TreePrefix) Print(indent int, last bool)

Jump to

Keyboard shortcuts

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