Documentation ¶
Index ¶
- Variables
- func BeginLoading(format string, a ...any)
- func BeginProgressBar(format string, a ...any)
- func CancelLoading()
- func CancelProgressBar()
- func Clear()
- func Error(format string, a ...any)
- func FinishLoading()
- func FinishProgressBar()
- func Input(prompt string, validators ...Validator) (string, error)
- func InputOptional(prompt string, validators ...Validator) (string, error)
- func MultiSelect(msg string, options []string, selected []int) ([]bool, error)
- func Print(format string, a ...any)
- func PrintColor(color Color, format string, a ...any)
- func Select(msg string, options []string) (int, error)
- func SelectString(msg string, displayOptions []string, options []string) (string, error)
- func Success(format string, a ...any)
- func UpdateProgressBar(progress float64)
- func Warn(format string, a ...any)
- func YesNo(question string, defaultValue bool) (yes bool, err error)
- type Color
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCanceled = errors.New("canceled")
ErrCanceled indicates that the user has interrupted the programm, e.g. by using Ctrl + C.
Functions ¶
func BeginLoading ¶
func BeginProgressBar ¶
func CancelLoading ¶
func CancelLoading()
func CancelProgressBar ¶
func CancelProgressBar()
func FinishLoading ¶
func FinishLoading()
func FinishProgressBar ¶
func FinishProgressBar()
func InputOptional ¶ added in v0.2.2
InputOptional ask the user to input a line of text. Not required.
func MultiSelect ¶ added in v0.2.0
MultiSelect asks the user to select an arbitrary amount of options. It returns a boolean slice of length options with the chosen indices set to true.
func PrintColor ¶
func SelectString ¶
SelectString asks the user to select on option. It returns the entry in options with the chosen index. It panics if the length of displayOptions differs from the length of options.
func UpdateProgressBar ¶
func UpdateProgressBar(progress float64)
Types ¶
type Color ¶
type Color string
const ( Reset Color = "\x1b[0m" Black Color = "\x1b[30m" Red Color = "\x1b[31m" Green Color = "\x1b[32m" Yellow Color = "\x1b[33m" Blue Color = "\x1b[34m" Magenta Color = "\x1b[35m" Cyan Color = "\x1b[36m" White Color = "\x1b[37m" BlackBold Color = "\x1b[1;30m" RedBold Color = "\x1b[1;31m" GreenBold Color = "\x1b[1;32m" YellowBold Color = "\x1b[1;33m" BlueBold Color = "\x1b[1;34m" MagentaBold Color = "\x1b[1;35m" CyanBold Color = "\x1b[1;36m" WhiteBold Color = "\x1b[1;37m" )
Click to show internal directories.
Click to hide internal directories.