prompt

package
v0.0.0-...-8ca6fb7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var New = func(executor func(string), completer func(goprompt.Document) []goprompt.Suggest, opt ...goprompt.Option) Prompt {
	return newPrompt(executor, completer, opt...)
}

New instantiates a prompt which satisfied Prompt with c-bata/go-prompt. New will be replace by a mock when e2e testing.

Prompt will panic when called Run if executor is nil.

TODO: Don't declare New as a variable.

Functions

This section is empty.

Types

type Prompt

type Prompt interface {
	// Run executes Input continually.
	// It is called from REPL input prompter.
	// Run will be finished when a user enters CTRL+d.
	Run()

	// Input receives user entered input.
	// Input will be abort when a user enters CTRL+d.
	Input() (string, error)

	// Select displays a selection consists of opts.
	Select(msg string, opts []string) (string, error)

	// SetPrefix chnages current prompt prefix by passed one.
	SetPrefix(prefix string)

	// SetPrefixColor changes current prompt color by passed one.
	SetPrefixColor(color color.Color) error
}

Prompt provides interactive interfaces to receive user input.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL