Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ERR_READLINE = errors.New("unable to create line reader") ERR_SIGINT_RECEIVED = errors.New("sigint received") ERR_INVALID_INPUT = errors.New("no valid input specified") ERR_MIN_INPUT_LEN = errors.New("longer input required") ERR_READ_BYTE = errors.New("unabel to read input byte") )
Functions ¶
func PrintError ¶
func PrintError(err error)
func PrintErrorMsg ¶
func PrintErrorMsg(msg string)
Types ¶
type Confirm ¶
type Confirm struct {
// Default value is false, meaning no
Default bool
// If kept as default false, the prompt is repeated until a valid anser is provided, otherwise if true, only asking once
OnlyOnce bool
// Prompt Text
Prompt string
}
Basic Yes/No Dialog
func (Confirm) AskBool ¶
The returned bool is always true for yes and false for no, independent of the set default response
func (Confirm) AskBoolDefaultOnErr ¶
func (Confirm) AskBoolFalseOnErr ¶
type Input ¶
type Input struct {
// default input to use when only pressing enter, shown in parenthesis after the prompt, if set
Default string
// input validation function
Validate ValidateFunc
// if kept as default false, the prompt is repeated until a valid anser is provided, otherwise if true, only asking once
OnlyOnce bool
// Prompt Text, colon with single trailing space will be appended as separator to user input
Prompt string
// add mandatory prefix for input
ForcePrefix string
}
Input Dialog
func (Input) GetEmptyOnErr ¶
type Progress ¶
type Progress struct {
// duration between loading char, default 100ms
LoadingSpeed time.Duration
// if set, show ASCII only loading symbol instead of unicode special char
FallbackAscii bool
}
func (Progress) Start ¶
func (p Progress) Start(initialTaskText string) chan<- TaskOperation
startLoadingTask starts a non-blocking loading task. It returns a channel to send task operations and a function to stop the loading.
type Select ¶ added in v0.3.4
type TaskOperation ¶
type ValidateFunc ¶
Click to show internal directories.
Click to hide internal directories.