Documentation ¶
Index ¶
- func Ask(qs []*Question) (map[string]string, error)
- func AskOne(p Prompt) (string, error)
- func AskOneValidate(p Prompt, v Validator) (string, error)
- func CursorLocation() (*cursorCoordinate, error)
- func Required(str string) error
- type Choice
- type Input
- type Password
- type Prompt
- type Question
- type TerminalKey
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskOneValidate ¶
AskOneValidate asks a single question and validates the answer with v.
func CursorLocation ¶
func CursorLocation() (*cursorCoordinate, error)
CursorLocation returns the location (col, row) of the cursor in the current terminal session.
Types ¶
type Choice ¶
Choice is a prompt that presents a list of various options to the user for them to select using the arrow keys and enter.
type Input ¶
Input is a regular text input that prints each character the user types on the screen and accepts the input with the enter key.
type Password ¶
type Password struct {
Message string
}
Password is like a normal Input but the text shows up as *'s and there is no default.
type Prompt ¶
Prompt is the primary interface for the objects that can take user input and return a string value.
type TerminalKey ¶
type TerminalKey int
TerminalKey is a type used to refer to keys of interest
const ( KeyArrowUp TerminalKey = iota KeyArrowDown KeyArrowLeft KeyArrowRight KeyEsc KeyEnter KeyNull )
key codes for the common keys