Documentation
¶
Overview ¶
Package prompt reads answers from the user. On a terminal, it turns off the echo for passwords. When stdin is not a terminal, it reads each answer as one line from stdin, so scripts can pipe the answers in.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoInput = errors.New("no input: stdin closed before the answer")
ErrNoInput means that stdin closed before an answer came.
Functions ¶
func IsTerminal ¶
IsTerminal reports whether the file is a terminal.
Types ¶
type Prompter ¶
type Prompter struct {
// contains filtered or unexported fields
}
Prompter asks questions on stderr and reads the answers from stdin.
func (*Prompter) Reader ¶
Reader returns the buffered stdin. Use it to read the rest of stdin after a prompt, so no buffered bytes get lost.