Documentation
¶
Index ¶
- Variables
- func GenerateRandomAoB(length int64) []byte
- func IntToHex(num int64) []byte
- func IsTimeOut(start, timeOut int64) bool
- func UintToHex(num uint64) []byte
- type TerminalPrompter
- func (p *TerminalPrompter) AppendHistory(command string)
- func (p *TerminalPrompter) GetPassPhrase(prompt string, confirmation bool) string
- func (p *TerminalPrompter) Prompt(prompt string) (string, error)
- func (p *TerminalPrompter) PromptConfirm(prompt string) (bool, error)
- func (p *TerminalPrompter) PromptPassphrase(prompt string) (passwd string, err error)
- func (p *TerminalPrompter) SetHistory(history []string)
- func (p *TerminalPrompter) SetWordCompleter(completer liner.WordCompleter)
- type UserPrompter
Constants ¶
This section is empty.
Variables ¶
var Stdin = NewTerminalPrompter()
Stdin holds the stdin line reader (also using stdout for printing prompts).
Functions ¶
func GenerateRandomAoB ¶
Types ¶
type TerminalPrompter ¶ added in v0.1.2
type TerminalPrompter struct {
// contains filtered or unexported fields
}
TerminalPrompter terminal prompter
func NewTerminalPrompter ¶ added in v0.1.2
func NewTerminalPrompter() *TerminalPrompter
NewTerminalPrompter create a terminal prompter
func (*TerminalPrompter) AppendHistory ¶ added in v0.1.2
func (p *TerminalPrompter) AppendHistory(command string)
AppendHistory appends an entry to the scrollback history.
func (*TerminalPrompter) GetPassPhrase ¶ added in v0.1.2
func (p *TerminalPrompter) GetPassPhrase(prompt string, confirmation bool) string
getPassPhrase get passphrase from consle
func (*TerminalPrompter) Prompt ¶ added in v0.1.2
func (p *TerminalPrompter) Prompt(prompt string) (string, error)
Prompt shows the prompt and requests text input returning the input.
func (*TerminalPrompter) PromptConfirm ¶ added in v0.1.2
func (p *TerminalPrompter) PromptConfirm(prompt string) (bool, error)
PromptConfirm shows the prompt to the user and requests a boolean choice to be made, returning that choice.
func (*TerminalPrompter) PromptPassphrase ¶ added in v0.1.2
func (p *TerminalPrompter) PromptPassphrase(prompt string) (passwd string, err error)
PromptPassphrase shows the prompt and request passphrase text input, the passphrase not show, returns the passphrase
func (*TerminalPrompter) SetHistory ¶ added in v0.1.2
func (p *TerminalPrompter) SetHistory(history []string)
SetHistory sets the history that the prompter will allow the user to scroll back to.
func (*TerminalPrompter) SetWordCompleter ¶ added in v0.1.2
func (p *TerminalPrompter) SetWordCompleter(completer liner.WordCompleter)
SetWordCompleter sets the completion function that the prompter will call to fetch completion candidates when the user presses tab.
type UserPrompter ¶ added in v0.1.2
type UserPrompter interface {
Prompt(prompt string) (string, error)
PromptPassphrase(prompt string) (passwd string, err error)
PromptConfirm(prompt string) (bool, error)
SetHistory(history []string)
AppendHistory(command string)
SetWordCompleter(completer liner.WordCompleter)
}
UserPrompter handle console user input interactive