ui

package
v1.10.24 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 10 Imported by: 30

Documentation

Overview

simple ui - TODO use something more sophisticated :)

Index

Constants

View Source
const CloudIcon = "☁️"
View Source
const IconBox = "📦"

IconBox emoji

View Source
const IconCabinet = "🗄️"

IconCabinet emoji

View Source
const IconCheckMark = "✅"

IconCheckMark emoji

View Source
const IconCross = "❌"

IconCross emoji

View Source
const IconDocumentation = "📖"

IconDocumentation emoji

View Source
const IconError = "💔"

IconError emoji

View Source
const IconFile = "📂"

IconFile emoji

View Source
const IconKey = "🔑"

IconKey emoji

View Source
const IconMedal = "🥇"

IconMedal emoji

View Source
const IconMicroscope = "🔬"

IconMicroscope emoji

View Source
const IconRocket = "🚀"

IconRocket emoji

View Source
const IconSuggestion = "💡"

IconSuggestion emoji

View Source
const IconTruck = "🚚"

IconTruck emoji

View Source
const IconUnlocked = "🔓"

IconUnlocked emoji

View Source
const IconWarning = "🚨"

IconWarning emoji

View Source
const IconWorld = "🌍"

IconWorld 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
	LightMagenta = color.FgLightMagenta.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 Alert added in v1.9.9

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

func CommandOutput

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

func Completed

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

func Confirm added in v1.9.9

func Confirm(message string) bool

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

func IsVerbose() bool

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

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

func PrintConfigApiError added in v1.5.15

func PrintConfigApiError(err error)

PrintConfigApiError prints error message suggestion and documentation link

func PrintConfigError added in v1.5.6

func PrintConfigError(err error)

PrintConfigError prints error message suggestion and documentation link

func PrintDisabled added in v1.5.6

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

func PrintEnabled added in v1.5.6

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

func PrintOnError

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

func Printf added in v1.5.10

func Printf(format string, data ...any)

func SetVerbose added in v1.0.16

func SetVerbose(verbose bool)

func ShellCommand

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

func Success

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

func SuccessAndExit added in v1.0.23

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

func Table

func Table(tableData TableData, writer io.Writer)

func UseStderr added in v1.2.15

func UseStderr()

func UseStdout added in v1.2.15

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 added in v0.8.4

type UI struct {
	Verbose bool
	Writer  io.Writer
}

func NewStderrUI added in v1.2.15

func NewStderrUI(verbose bool) *UI

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) Alert added in v1.9.9

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

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) Confirm added in v1.9.9

func (ui *UI) Confirm(message string) bool

Conofirm prints string requesting a boolean y/n confirmation

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) Print added in v1.5.6

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

func (*UI) PrintDisabled added in v1.5.6

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

PrintDisabled shows insuccess in terminal

func (*UI) PrintEnabled added in v1.5.6

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

PrintEnabled shows enabled in terminal

func (*UI) PrintOnError added in v0.8.4

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

func (*UI) Printf added in v1.5.10

func (ui *UI) Printf(format string, data ...any)

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)

Success shows success in terminal

func (*UI) SuccessAndExit added in v1.0.23

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

SuccessAndExit shows success in terminal and exit

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