ui

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Success = color.New(color.FgGreen).SprintFunc()
	Error   = color.New(color.FgRed).SprintFunc()
	Warning = color.New(color.FgYellow).SprintFunc()
	Info    = color.New(color.FgCyan).SprintFunc()
	Bold    = color.New(color.Bold).SprintFunc()
)

Colors for consistent output

View Source
var Stderr io.Writer = os.Stderr

Stderr is the destination for PrintError. Defaults to os.Stderr; tests swap.

View Source
var Stdout io.Writer = os.Stdout

Stdout is the destination for Print* helpers. Defaults to os.Stdout; tests swap to a buffer to capture output.

Functions

func Confirm

func Confirm(message string, defaultValue bool) (bool, error)

Confirm asks for user confirmation

func Editor

func Editor(message, defaultValue string) (string, error)

Editor opens a text editor for multi-line input

func Input

func Input(message, defaultValue string, validator survey.Validator) (string, error)

Input asks for text input

func InputWithHelp

func InputWithHelp(message, defaultValue, help string, validator survey.Validator) (string, error)

InputWithHelp asks for text input with help text

func MultiSelect

func MultiSelect(message string, options []string) ([]string, error)

MultiSelect presents a multi-selection list

func Password

func Password(message string) (string, error)

Password asks for password input

func PasswordWithHelp

func PasswordWithHelp(message, help string) (string, error)

PasswordWithHelp asks for password input with help text

func PrintDebugf

func PrintDebugf(format string, args ...interface{})

PrintDebugf prints a debug message

func PrintErrorf

func PrintErrorf(format string, args ...interface{})

PrintErrorf prints an error message

func PrintHeader

func PrintHeader(text string)

PrintHeader prints a section header

func PrintInfof

func PrintInfof(format string, args ...interface{})

PrintInfof prints an info message

func PrintKeyValue

func PrintKeyValue(key, value string)

PrintKeyValue prints a key-value pair

func PrintList

func PrintList(items []string)

PrintList prints a list of items

func PrintNumberedList

func PrintNumberedList(items []string)

PrintNumberedList prints a numbered list of items

func PrintSubheader

func PrintSubheader(text string)

PrintSubheader prints a subsection header

func PrintSuccessf

func PrintSuccessf(format string, args ...interface{})

PrintSuccessf prints a success message

func PrintWarningf

func PrintWarningf(format string, args ...interface{})

PrintWarningf prints a warning message

func Required

func Required(val interface{}) error

Required is a validator that ensures input is not empty

func Select

func Select(message string, options []string) (string, error)

Select presents a selection list

func SelectWithHelp

func SelectWithHelp(message string, options []string, help string) (string, error)

SelectWithHelp presents a selection list with help text

func StartSpinner

func StartSpinner(message string) *spinner.Spinner

StartSpinner starts a loading spinner with a message

func StopSpinner

func StopSpinner(s *spinner.Spinner, message string)

StopSpinner stops a spinner with a success message

func StopSpinnerError

func StopSpinnerError(s *spinner.Spinner, message string)

StopSpinnerError stops a spinner with an error message

Types

This section is empty.

Jump to

Keyboard shortcuts

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