Documentation ¶
Overview ¶
Package dialog provides a set of interactive dialogs for user.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAborted is returned when user pressed ^C. ErrAborted = fmt.Errorf("dialog aborted") )
Functions ¶
func Message ¶
Message shows a message that's dismissed by pressing enter. Should not fail, but if it's important checking error value is optional. Any errors are logged.
func Question ¶
Question asks the user a multiple-choice question. ^C is always a valid option, and returns ErrAborted. Example: `Should I send that email now?`
func TrimOneChar ¶
TrimOneChar removes bytes until the printed size of the string is reduced. This is used by "backspace". TODO: should this use utf8.DecodeLastRuneInString to remove one codepoint at a time?
Types ¶
type Option ¶
Option is one option in a multiple-choice dialog.
func Selection ¶
Selection asks the user for a choice, with populated suggestions that can be searched in. If `free` is `true` then the user can input anything. If `false` then the options listed are the only valid ones. Example: Email recipient choice.
func Strings2Options ¶
Strings2Options takes a slice of strings and turns them into Options.