console

package
v0.0.0-...-5d85a61 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPrompt = "> "
View Source
const HistoryFile = "history"

Variables

View Source
var Stdin = newTerminalPrompter()

Functions

This section is empty.

Types

type Config

type Config struct {
	DataDir  string
	DocRoot  string
	Client   *rpc.Client
	Prompt   string
	Prompter UserPrompter
	Printer  io.Writer
	Preload  []string
}

type Console

type Console struct {
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Console, error)

func (*Console) AutoCompleteInput

func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, string)

func (*Console) Evaluate

func (c *Console) Evaluate(statement string) error

func (*Console) Execute

func (c *Console) Execute(path string) error

func (*Console) Interactive

func (c *Console) Interactive()

func (*Console) Stop

func (c *Console) Stop(graceful bool) error

func (*Console) Welcome

func (c *Console) Welcome()

type UserPrompter

type UserPrompter interface {
	PromptInput(prompt string) (string, error)

	PromptPassword(prompt string) (string, error)

	PromptConfirm(prompt string) (bool, error)

	SetHistory(history []string)

	AppendHistory(command string)

	ClearHistory()

	SetWordCompleter(completer WordCompleter)
}

type WordCompleter

type WordCompleter func(line string, pos int) (string, []string, string)

Jump to

Keyboard shortcuts

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