cli

package
v1.15.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MPL-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 added in v1.15.0

func (b *BasicUI) ErrorOutput(s string)

func (*BasicUI) HeaderOutput added in v1.15.0

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 added in v1.15.0

func (b *BasicUI) SuccessOutput(s string)

func (*BasicUI) Table added in v1.15.0

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

Table implements UI.

func (*BasicUI) UnchangedOutput added in v1.15.0

func (b *BasicUI) UnchangedOutput(s string)

func (*BasicUI) WarnOutput added in v1.15.0

func (b *BasicUI) WarnOutput(s string)

type Cell added in v1.15.0

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 added in v1.15.0

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

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

func NewTable added in v1.15.0

func NewTable(headers ...string) *Table

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

func (*Table) AddRow added in v1.15.0

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 added in v1.15.0

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