ui

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxOutputLineLength = 80
	IndentWidth         = 2
)

Variables

This section is empty.

Functions

func Attentionf

func Attentionf(format string, a ...any)

func Confirm

func Confirm(message string, defaultValue string) bool

func Debugf added in v0.1.13

func Debugf(format string, a ...any)

func Errorf

func Errorf(format string, a ...any)

func Fatal added in v0.1.36

func Fatal(msg string, err error)

Fatal prints an error message. It checks is the error is a types.Error and prints the verbose message if it is.

You should use this function instead of Errorf (which is being deprecated).

func FormatVolumes added in v0.1.36

func FormatVolumes(volumes []types.ExecVolume) string

func HandleError

func HandleError(err error) error

func Infof

func Infof(format string, a ...any)

func MaxFieldLength added in v0.1.36

func MaxFieldLength[T any](data []T, getField func(T) string) int

MaxFieldLength can be used to compute the maximum length of any given column based on the length of the greatest row

func Result

func Result(entries []ResultEntry, indentation uint)

func ResultTitle

func ResultTitle(title string)

func Select

func Select(label string, options []string) (int, error)

func Successf

func Successf(format string, a ...any)

func Table

func Table(title string, cols []Column, rows []Row)

Types

type Column

type Column struct {
	Title string
	Width int
}

type Error

type Error struct {
	*types.Error
}

func (*Error) Short

func (e *Error) Short() string

func (*Error) Verbose

func (e *Error) Verbose() string

type ResultEntry

type ResultEntry struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Row

type Row []string

Jump to

Keyboard shortcuts

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