output

package
v0.0.0-...-950a29a Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnsiReset     = "\033[0m"
	AnsiBold      = "\u001B[1m"
	AnsiItalic    = "\u001B[3m"
	AnsiUnderline = "\u001B[4m"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnsiColor

type AnsiColor int
const (
	AnsiBlack AnsiColor = iota + 30
	AnsiRed
	AnsiGreen
	AnsiYellow
	AnsiBlue
	AnsiMagenta
	AnsiCyan
	AnsiWhite

	AnsiBackground AnsiColor = 10
	AnsiBright     AnsiColor = 60
)

type Column

type Column struct {
	Index int
	Name  string
	Width int
}

type Displayable

type Displayable interface {
	Columns() []string
	Values() map[string]interface{}
}

type Output

type Output struct {
	Writer       io.Writer
	EnableColors bool
}

func NewConsoleOutput

func NewConsoleOutput(writer *os.File) *Output

func (*Output) AnsiSequence

func (o *Output) AnsiSequence(sequence string) *Output

func (*Output) Bold

func (o *Output) Bold(format string, a ...interface{}) *Output

func (*Output) Color

func (o *Output) Color(color AnsiColor) *Output

func (*Output) DisplayJson

func (o *Output) DisplayJson(object interface{}) error

func (*Output) DisplayTable

func (o *Output) DisplayTable(object interface{}, separator string, pretty bool) error

func (*Output) Errorf

func (o *Output) Errorf(format string, a ...interface{}) *Output

func (*Output) Print

func (o *Output) Print(a ...interface{}) *Output

func (*Output) Printf

func (o *Output) Printf(format string, a ...interface{}) *Output

func (*Output) Println

func (o *Output) Println(a ...interface{}) *Output

func (*Output) Reset

func (o *Output) Reset() *Output

type Progress

type Progress struct {
	Message string
	Done    chan string
	Sync    chan struct{}
}

func NewProgress

func NewProgress(message string) *Progress

func (*Progress) Complete

func (p *Progress) Complete(message string)

func (*Progress) Display

func (p *Progress) Display(output *Output)

type Table

type Table struct {
	Columns []*Column
	Rows    [][]string
}

func (*Table) FindColumn

func (t *Table) FindColumn(name string) *Column

func (*Table) Format

func (t *Table) Format(out *Output, separator string, pretty bool)

func (*Table) Insert

func (t *Table) Insert(val interface{}) error

Jump to

Keyboard shortcuts

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