Documentation ¶
Index ¶
- Constants
- Variables
- type Console
- type JSRE
- func (j *JSRE) Compile(filename string, src interface{}) error
- func (j *JSRE) CompleteKeywords(line string) []string
- func (j *JSRE) Get(name string) (otto.Value, error)
- func (j *JSRE) JSONString(val otto.Value) (string, error)
- func (j *JSRE) Run(src string) (otto.Value, error)
- func (j *JSRE) Set(name string, value interface{}) error
- type TerminalPrompter
- func (p *TerminalPrompter) AppendHistory(command 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 ¶
const (
//APIVersion rpc http version
APIVersion = "v1"
)
Variables ¶
var ( FunctionColor = color.New(color.FgMagenta).SprintfFunc() SpecialColor = color.New(color.Bold).SprintfFunc() NumberColor = color.New(color.FgRed).SprintfFunc() StringColor = color.New(color.FgGreen).SprintfFunc() ErrorColor = color.New(color.FgHiRed).SprintfFunc() )
var Stdin = NewTerminalPrompter()
Stdin holds the stdin line reader (also using stdout for printing prompts).
Functions ¶
This section is empty.
Types ¶
type Console ¶
type Console struct {
// contains filtered or unexported fields
}
func NewConsole ¶
func NewConsole(conn *grpc.ClientConn) *Console
New a console by Config, neb.config params is need
func (*Console) AutoComplete ¶
AutoComplete console auto complete input
func (*Console) Interactive ¶
func (c *Console) Interactive()
Interactive starts an interactive user session.
type JSRE ¶
type JSRE struct {
// contains filtered or unexported fields
}
JSRE javascript runtime environment
func (*JSRE) CompleteKeywords ¶
CompleteKeywords returns potential continuations for the given line.
func (*JSRE) JSONString ¶
JSONString convert value to json string
type TerminalPrompter ¶
type TerminalPrompter struct {
// contains filtered or unexported fields
}
TerminalPrompter terminal prompter
func NewTerminalPrompter ¶
func NewTerminalPrompter() *TerminalPrompter
NewTerminalPrompter create a terminal prompter
func (*TerminalPrompter) AppendHistory ¶
func (p *TerminalPrompter) AppendHistory(command string)
AppendHistory appends an entry to the scrollback history.
func (*TerminalPrompter) Prompt ¶
func (p *TerminalPrompter) Prompt(prompt string) (string, error)
Prompt shows the prompt and requests text input returning the input.
func (*TerminalPrompter) PromptConfirm ¶
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 ¶
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 ¶
func (p *TerminalPrompter) SetHistory(history []string)
SetHistory sets the history that the prompter will allow the user to scroll back to.
func (*TerminalPrompter) SetWordCompleter ¶
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 ¶
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