Documentation
¶
Index ¶
- type Keyboard
- type Menu
- func (menu *Menu) Choose(choices []string, idx int, searchStr string, keys ...string) (int, string)
- func (menu *Menu) Clear()
- func (menu *Menu) Search(choices []string, searchStr string) int
- func (menu *Menu) SearchNext(choices []string, searchStr string) int
- func (menu *Menu) Show(choices []string)
- type Prompt
- func (prompt *Prompt) Ask(question string, history []string, completers ...func(string) []string) (string, error)
- func (prompt *Prompt) AskYesNo(question string) (bool, error)
- func (prompt *Prompt) GetAnswer(question string, history *[]string, completers ...func(string) []string) string
- func (prompt *Prompt) GetRune(question string) rune
- type Screen
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
Menu helps create a searchable, flexible, on-screen menu.
func (*Menu) Choose ¶
Choose is the main interaction loop for the menu. It takes three required inputs: a list of choices (strings), a current-selection-index (int), and an initial search string (often ""). Optionally you can also pass a list of "keys" (strings) to listen for.
The function returns two things: the integer index of the current selection, and the string description of the key that caused the program to exit.
func (*Menu) SearchNext ¶
SearchNext searches menu options from the current option on.
type Prompt ¶
type Prompt struct {
// contains filtered or unexported fields
}
Prompt is a user-input prompt.
func MakePrompt ¶
MakePrompt creates a new prompt object.
func (*Prompt) Ask ¶
func (prompt *Prompt) Ask(question string, history []string, completers ...func(string) []string) (string, error)
Ask asks the user a question, expecting a string response.