Documentation
¶
Overview ¶
Package prompt implements the small set of interactive TTY prompts SSLKnife needs: confirmations, passwords, free text and choices.
Index ¶
- Variables
- type Prompter
- func (p *Prompter) Choose(question string, options []string, def int) (int, error)
- func (p *Prompter) Confirm(question string, def bool) (bool, error)
- func (p *Prompter) Interactive() bool
- func (p *Prompter) Line(question, def string) (string, error)
- func (p *Prompter) Lines(question string) ([]string, error)
- func (p *Prompter) NewPassword(question string, minLen int) ([]byte, error)
- func (p *Prompter) Password(question string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotInteractive = errors.New("input required but no terminal is attached")
ErrNotInteractive is returned when a prompt is needed but no terminal is attached. Callers should tell the user which flag or env var to use.
Functions ¶
This section is empty.
Types ¶
type Prompter ¶
type Prompter struct {
// contains filtered or unexported fields
}
Prompter reads answers from in and writes questions to out.
func NewScripted ¶
NewScripted creates a prompter that reads answers from in regardless of whether it is a terminal. Used by tests.
func (*Prompter) Interactive ¶
Interactive reports whether prompting is possible.
func (*Prompter) NewPassword ¶
NewPassword asks for a password twice and checks that both match.
Click to show internal directories.
Click to hide internal directories.