Documentation
¶
Overview ¶
Package prompt asks questions on a terminal. Ctrl-C ends the process with 130 and without a stack trace, as the TypeScript CLI's prompts did.
Index ¶
- Variables
- func Confirm(message string, defaultYes, nonInteractive bool) (bool, error)
- func HTTPURL(value string) error
- func Input(message, defaultValue string, validate Validator) (string, error)
- func NotBlank(value string) error
- func Password(message string, validate Validator) (string, error)
- func UseInput(r io.Reader)
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var Interactive = func() bool { return term.IsTerminal(int(os.Stdout.Fd())) }
Interactive reports whether a question would be seen: stdout is a terminal. Tests replace it.
Functions ¶
func Confirm ¶
Confirm asks a yes/no question. When stdout is not a terminal, as in a pipeline or with output redirected to a file, nobody would see the question, and it answers nonInteractive. This is the TypeScript CLI's check, so the same invocations ask as before.
Types ¶
Click to show internal directories.
Click to hide internal directories.