ui

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2021 License: MIT Imports: 16 Imported by: 7

Documentation

Overview

Package ui helps get user input from the terminal, and formats output.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorSkipped = errors.New("skipped choice")
)

Functions

func Accept

func Accept(question string) bool

Accept asks a question and returns the answer.

func Blue

func Blue(in string) string

Blue outputs a string in blue.

func BlueBold

func BlueBold(in string) string

BlueBold outputs a string in blue bold.

func BlueBoldUnderlined added in v0.13.0

func BlueBoldUnderlined(in string) string

BlueBold outputs a string in blue bold.

func BlueDark added in v0.13.0

func BlueDark(in string) string

Blue outputs a string in blue.

func BlueUnderlined added in v0.10.0

func BlueUnderlined(in string) string

BlueUnderlined outputs a string in blue, underlined.

func Edit added in v0.13.0

func Edit(oldValue string) (string, error)

Edit long value using external $EDITOR.

func GetInput

func GetInput(in *os.File) (string, error)

GetInput from user.

func Green

func Green(in string) string

Green outputs a string in green.

func GreenBold

func GreenBold(in string) string

GreenBold outputs a string in green bold.

func GreenUnderlined added in v0.10.0

func GreenUnderlined(in string) string

GreenUnderlined outputs a string in green, underlined.

func Header(msg string, args ...interface{})

Header message logging.

func Red

func Red(in string) string

Red outputs a string in red.

func RedBold

func RedBold(in string) string

RedBold outputs a string in red bold.

func RedUnderlined added in v0.10.0

func RedUnderlined(in string) string

RedUnderlined outputs a string in red, underlined.

func RemoveColor added in v0.7.1

func RemoveColor(str string) string

func SelectAmongOptions added in v0.13.0

func SelectAmongOptions(title, usage string, options []string, optionTags map[string]string) (string, error)

func SelectAmongStrictOptions added in v0.39.1

func SelectAmongStrictOptions(title, usage string, options []string, optionTags map[string]string) (string, error)

func SelectAmongValues added in v0.13.0

func SelectAmongValues(title, usage string, options []string, optionTags map[string]string) (string, error)

func SelectLongOptionalValue added in v0.13.0

func SelectLongOptionalValue(title, usage string, options []string) (string, error)

func SelectLongValue added in v0.13.0

func SelectLongValue(title, usage string, options []string) (string, error)

func SelectOptionalValue added in v0.13.0

func SelectOptionalValue(title, usage string, options []string) (string, error)

func SelectValue added in v0.13.0

func SelectValue(title, usage string, options []string) (string, error)

func SpinWhileThingsHappen

func SpinWhileThingsHappen(title string, f func() error) error

SpinWhileThingsHappen is a way to launch a function and display a spinner while it is being executed.

func TabulateMap added in v0.9.0

func TabulateMap(input map[string]int, firstHeader string, secondHeader string) (table string)

TabulateMap of map[string]int.

func TabulateRows added in v0.9.0

func TabulateRows(rows [][]string, headers ...string) (table string)

TabulateRows of map[string]int.

func Title added in v0.13.0

func Title(msg string, args ...interface{})

Title message logging.

func Usage added in v0.13.0

func Usage(msg string, args ...interface{})

Usage message logging.

func UserChoice

func UserChoice(msg string, args ...interface{})

UserChoice message logging.

func Warning added in v0.9.0

func Warning(in string) string

Warning output.

func Yellow

func Yellow(in string) string

Yellow outputs a string in yellow.

func YellowBold added in v0.13.0

func YellowBold(in string) string

YellowBold outputs a string in bold yellow.

func YellowUnderlined

func YellowUnderlined(in string) string

YellowUnderlined outputs a string in yellow, underlined.

Types

This section is empty.

Jump to

Keyboard shortcuts

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