ui

package
v1.0.7-beta001 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 7 Imported by: 30

Documentation

Overview

simple ui - TODO use something more sophisticated :)

Index

Constants

View Source
const IconError = "💔"

IconError emoji

View Source
const IconMedal = "🥇"

IconMedal emoji

Variables

View Source
var (
	White       = color.FgWhite.Render
	Blue        = color.FgBlue.Render
	Green       = color.FgGreen.Render
	Yellow      = color.FgYellow.Render
	Red         = color.FgRed.Render
	LightYellow = color.FgLightYellow.Render
	LightCyan   = color.FgLightCyan.Render
	LightGray   = color.FgGray.Render
	LightRed    = color.FgLightRed.Render
	LightBlue   = color.FgLightBlue.Render
	DarkGray    = color.FgDarkGray.Render
)
View Source
var Verbose = false

Verbose adds additional info messages e.g. in case of checking errors

View Source
var Writer io.Writer = os.Stdout

Functions

func CommandOutput

func CommandOutput(output []byte, command string, params ...string)

func Completed

func Completed(message string, subMessages ...string)

func Debug added in v0.7.3

func Debug(message string, subMessages ...string)

func Err

func Err(err error)

func Errf

func Errf(err string, params ...interface{})

func ExitOnError

func ExitOnError(item string, errors ...error)

func Fail

func Fail(err error)

func Failf

func Failf(err string, params ...interface{})

func GroupCompleted

func GroupCompleted(main string, sub ...string)

func Info

func Info(message string, subMessages ...string)

func InfoGrid

func InfoGrid(table map[string]string)

func JSONTable

func JSONTable(tableData TableData, writer io.Writer) error

func LogLine added in v0.6.5

func LogLine(message string)
func Logo()

func LogoNoColor

func LogoNoColor()

func Medal

func Medal()

func NL

func NL()

func PrintOnError

func PrintOnError(item string, errors ...error)

func ShellCommand

func ShellCommand(title string, commands ...string)

func Success

func Success(message string, subMessages ...string)

func Table

func Table(tableData TableData, writer io.Writer)

func Vector

func Vector(table []string)

func Warn

func Warn(message string, subMessages ...string)

func WarnOnError

func WarnOnError(item string, errors ...error)

Types

type ArrayTable

type ArrayTable [][]string

func NewArrayTable

func NewArrayTable(a [][]string) ArrayTable

func (ArrayTable) Table

func (a ArrayTable) Table() (header []string, data [][]string)

type TableData

type TableData interface {
	Table() (header []string, data [][]string)
}

type UI added in v0.8.4

type UI struct {
	Verbose bool
	Writer  io.Writer
}

func NewStdoutUI added in v0.8.4

func NewStdoutUI(verbose bool) *UI

func NewUI added in v0.8.4

func NewUI(verbose bool, writer io.Writer) *UI

func (*UI) CommandOutput added in v0.8.4

func (ui *UI) CommandOutput(output []byte, command string, params ...string)

func (*UI) Completed added in v0.8.4

func (ui *UI) Completed(main string, sub ...string)

func (*UI) Debug added in v0.8.4

func (ui *UI) Debug(message string, subMessages ...string)

func (*UI) Err added in v0.8.4

func (ui *UI) Err(err error)

func (*UI) Errf added in v0.8.4

func (ui *UI) Errf(err string, params ...interface{})

func (*UI) ExitOnError added in v0.8.4

func (ui *UI) ExitOnError(item string, errors ...error)

func (*UI) Fail added in v0.8.4

func (ui *UI) Fail(err error)

func (*UI) Failf added in v0.8.4

func (ui *UI) Failf(err string, params ...interface{})

func (*UI) GroupCompleted added in v0.8.4

func (ui *UI) GroupCompleted(main string, sub ...string)

func (*UI) Info added in v0.8.4

func (ui *UI) Info(message string, subMessages ...string)

func (*UI) InfoGrid added in v0.8.4

func (ui *UI) InfoGrid(table map[string]string)

func (*UI) JSONTable added in v0.8.4

func (ui *UI) JSONTable(tableData TableData, writer io.Writer) error

func (*UI) LogLine added in v0.8.4

func (ui *UI) LogLine(message string)
func (ui *UI) Logo()

func (*UI) LogoNoColor added in v0.8.4

func (ui *UI) LogoNoColor()

func (*UI) Medal added in v0.8.4

func (ui *UI) Medal()

func (*UI) NL added in v0.8.4

func (ui *UI) NL()

func (*UI) NewArrayTable added in v0.8.4

func (ui *UI) NewArrayTable(a [][]string) ArrayTable

func (*UI) PrintOnError added in v0.8.4

func (ui *UI) PrintOnError(item string, errors ...error)

func (*UI) ShellCommand added in v0.8.4

func (ui *UI) ShellCommand(title string, commands ...string)

Warn shows warning in terminal

func (*UI) Success added in v0.8.4

func (ui *UI) Success(message string, subMessages ...string)

Warn shows warning in terminal

func (*UI) Table added in v0.8.4

func (ui *UI) Table(tableData TableData, writer io.Writer)

func (*UI) Vector added in v0.8.4

func (ui *UI) Vector(table []string)

func (*UI) Warn added in v0.8.4

func (ui *UI) Warn(message string, subMessages ...string)

Warn shows warning in terminal

func (*UI) WarnOnError added in v0.8.4

func (ui *UI) WarnOnError(item string, errors ...error)

Jump to

Keyboard shortcuts

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