console

package
v2.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset     = "\033[0m"
	Bold      = "\u001B[1m"
	Italic    = "\u001B[3m"
	Underline = "\u001B[4m"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color int
const (
	Black Color = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White

	Background Color = 10
	Bright     Color = 60
)

type Column

type Column struct {
	Index int
	Name  string
	Width int
}

type Displayable

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

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(out Writer)

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 Writer, separator string, pretty bool)

func (*Table) Insert

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

type Writer

type Writer interface {
	io.Writer

	Color(color Color) Writer
	Bold() Writer
	Reset() Writer

	Printf(format string, a ...interface{}) Writer
	Print(a ...interface{}) Writer
	Println(a ...interface{}) Writer

	Errorf(format string, a ...interface{}) Writer
}

func NewConsoleOutput

func NewConsoleOutput(writer *os.File) Writer

func NewPlainWriter

func NewPlainWriter(writer io.Writer) Writer

Jump to

Keyboard shortcuts

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