ui

package
v1.0.25 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

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

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

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 SetVerbose

func SetVerbose(verbose bool)

func ShellCommand

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

func Success

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

func SuccessAndExit

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

func Table

func Table(tableData TableData, writer io.Writer)

func UseStderr

func UseStderr()

func UseStdout

func UseStdout()

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

type UI struct {
	Verbose bool
	Writer  io.Writer
}

func NewStderrUI

func NewStderrUI(verbose bool) *UI

func NewStdoutUI

func NewStdoutUI(verbose bool) *UI

func NewUI

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

func (*UI) CommandOutput

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

func (*UI) Completed

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

func (*UI) Debug

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

func (*UI) Err

func (ui *UI) Err(err error)

func (*UI) Errf

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

func (*UI) ExitOnError

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

func (*UI) Fail

func (ui *UI) Fail(err error)

func (*UI) Failf

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

func (*UI) GroupCompleted

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

func (*UI) Info

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

func (*UI) InfoGrid

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

func (*UI) JSONTable

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

func (*UI) LogLine

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

func (*UI) LogoNoColor

func (ui *UI) LogoNoColor()

func (*UI) Medal

func (ui *UI) Medal()

func (*UI) NL

func (ui *UI) NL()

func (*UI) NewArrayTable

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

func (*UI) PrintOnError

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

func (*UI) ShellCommand

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

Warn shows warning in terminal

func (*UI) Success

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

Success shows success in terminal

func (*UI) SuccessAndExit

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

SuccessAndExit shows success in terminal and exit

func (*UI) Table

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

func (*UI) Vector

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

func (*UI) Warn

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

Warn shows warning in terminal

func (*UI) WarnOnError

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