Documentation
¶
Index ¶
- Variables
- func AdvisoryColor(message string) string
- func Colorize(message string, color Color) string
- func ColorizeBold(message string, color Color) string
- func ColorsEnabled() bool
- func CommandColor(message string) string
- func CrashedColor(message string) string
- func Decolorize(message string) string
- func EntityNameColor(message string) string
- func FailureColor(message string) string
- func HeaderColor(message string) string
- func InitColorSupport()
- func LogAppHeaderColor(message string) string
- func LogHealthHeaderColor(message string) string
- func LogStderrColor(message string) string
- func LogStdoutColor(message string) string
- func LogSysHeaderColor(message string) string
- func PromptColor(message string) string
- func StoppedColor(message string) string
- func SuccessColor(message string) string
- func TableContentHeaderColor(message string) string
- func WarningColor(message string) string
- type Color
- type PrintableTable
- type Prompt
- type PromptOptions
- type Table
- type UI
- type ValidateFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TerminalSupportsColors = isTerminal() UserAskedForColors = "" )
View Source
var ( ErrInputEmpty = errors.New("input is empty") ErrInputNotNumber = errors.New("input is not a number") ErrInputNotFloatNumber = errors.New("input is not a floating point number") ErrInputNotBool = errors.New("input must be 'y', 'n', 'yes' or 'no'") ErrInputOutOfRange = errors.New("input is out of range") )
Functions ¶
func AdvisoryColor ¶
func ColorizeBold ¶
func ColorsEnabled ¶
func ColorsEnabled() bool
func CommandColor ¶
func CrashedColor ¶
func Decolorize ¶
func EntityNameColor ¶
func FailureColor ¶
func HeaderColor ¶
func InitColorSupport ¶
func InitColorSupport()
func LogAppHeaderColor ¶
func LogHealthHeaderColor ¶
func LogStderrColor ¶
func LogStdoutColor ¶
func LogSysHeaderColor ¶
func PromptColor ¶
func StoppedColor ¶
func SuccessColor ¶
func TableContentHeaderColor ¶
func WarningColor ¶
Types ¶
type PrintableTable ¶
type PrintableTable struct {
// contains filtered or unexported fields
}
func (*PrintableTable) Add ¶
func (t *PrintableTable) Add(row ...string)
func (*PrintableTable) Print ¶
func (t *PrintableTable) Print()
type Prompt ¶
Create Prompt with NewPrompt or NewChoicesPrompt
func NewChoicesPrompt ¶
func NewChoicesPrompt(message string, choices []string, options *PromptOptions) *Prompt
func NewPrompt ¶
func NewPrompt(message string, options *PromptOptions) *Prompt
type PromptOptions ¶
type PromptOptions struct { Required bool // If true, user input is required HideInput bool // If true, user input is hide, typically when asking password. TODO: support mask later HideDefault bool // If true, hide default value in the prompt message NoLoop bool // if true, when input is invalid, return error instead of asking user for retry ValidateFunc ValidateFunc // customized input validation function }
type UI ¶
type UI interface { Say(format string, args ...interface{}) Warn(format string, args ...interface{}) Failed(format string, args ...interface{}) Ok() Prompt(message string, options *PromptOptions) *Prompt ChoicesPrompt(message string, choices []string, options *PromptOptions) *Prompt // Deprecated: use Prompt() instead Ask(format string, args ...interface{}) (answer string) // Deprecated: use Prompt() instead AskForPassword(format string, args ...interface{}) (answer string) // Deprecated: use Prompt() instead Confirm(format string, args ...interface{}) bool // Deprecated: use Prompt() instead ConfirmWithDefault(defaultBool bool, format string, args ...interface{}) bool // Deprecated: use ChoicesPrompt() instead SelectOne(choices []string, format string, args ...interface{}) int Table(headers []string) Table Writer() io.Writer }
type ValidateFunc ¶
Click to show internal directories.
Click to hide internal directories.