cli

package
v1.16.109 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Yellow = "yellow"
	Green  = "green"
	Red    = "red"
)

Functions that are useful for table output.

Variables

View Source
var (
	UiColorNone    UiColor = UiColor{noColor, false}
	UiColorRed             = UiColor{int(color.FgHiRed), false}
	UiColorGreen           = UiColor{int(color.FgHiGreen), false}
	UiColorYellow          = UiColor{int(color.FgHiYellow), false}
	UiColorBlue            = UiColor{int(color.FgHiBlue), false}
	UiColorMagenta         = UiColor{int(color.FgHiMagenta), false}
	UiColorCyan            = UiColor{int(color.FgHiCyan), false}
)

A list of colors that are useful. These are all non-bolded by default.

Functions

This section is empty.

Types

type BasicUI

type BasicUI struct {
	mcli.BasicUi
}

BasicUI augments mitchellh/cli.BasicUi by exposing the underlying io.Writer.

func (*BasicUI) ErrorOutput

func (b *BasicUI) ErrorOutput(s string)

func (*BasicUI) HeaderOutput

func (b *BasicUI) HeaderOutput(s string)

func (*BasicUI) Stderr

func (b *BasicUI) Stderr() io.Writer

func (*BasicUI) Stdout

func (b *BasicUI) Stdout() io.Writer

func (*BasicUI) SuccessOutput

func (b *BasicUI) SuccessOutput(s string)

func (*BasicUI) Table

func (u *BasicUI) Table(tbl *Table)

Table implements UI.

func (*BasicUI) UnchangedOutput

func (b *BasicUI) UnchangedOutput(s string)

func (*BasicUI) WarnOutput

func (b *BasicUI) WarnOutput(s string)

type Cell

type Cell struct {
	Value string
	Color string
}

Cell is a single entry for a table.

type Command

type Command mcli.Command

Command is an alias to reduce the diff. It can be removed at any time.

type Table

type Table struct {
	Headers []string
	Rows    [][]Cell
}

Table is passed to UI.Table to provide a nicely formatted table.

func NewTable

func NewTable(headers ...string) *Table

NewTable creates a new Table structure that can be used with UI.Table.

func (*Table) AddRow

func (t *Table) AddRow(cols []string, colors []string)

AddRow adds a row to the table.

type Ui

type Ui interface {
	mcli.Ui
	Stdout() io.Writer
	Stderr() io.Writer
	ErrorOutput(string)
	HeaderOutput(string)
	WarnOutput(string)
	SuccessOutput(string)
	UnchangedOutput(string)
	Table(tbl *Table)
}

Ui implements the mitchellh/cli.Ui interface, while exposing the underlying io.Writer used for stdout and stderr. TODO: rename to UI to match golang style guide

type UiColor

type UiColor struct {
	Code int
	Bold bool
}

UiColor is a posix shell color code to use.

Jump to

Keyboard shortcuts

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