Documentation
¶
Overview ¶
Package prompt asks the yes/no confirmation questions of the CLI commands. A question gives up as soon as its context ends — a first Ctrl-C — instead of waiting for an answer that will never come.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoAnswer = errors.New("no answer to the confirmation prompt: stdin is closed")
ErrNoAnswer is returned by AskYes when its input ends before any answer is read, as with a closed stdin or one redirected from /dev/null.
Functions ¶
func AskYes ¶
AskYes prints question to out and reports whether the next line read from in is "y" or "yes", ignoring case and surrounding spaces. It returns ErrNoAnswer when in ends before a non-empty answer, ctx's error when ctx ends first (the read itself keeps waiting in the background, which is harmless as the process is about to exit), or the read error.
Types ¶
This section is empty.