cli

package
v0.0.0-...-2316576 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPromptAborted = errors.New("prompt aborted")

ErrPromptAborted is the error for prompt aborted. i.e. ctrl+d. not implement for go prompt

Functions

This section is empty.

Types

type Cleanup

type Cleanup func()

type Cli

type Cli interface {
	Output() bool
	ReadLine() (line string, exit bool, err error)
	Interactive() bool
	SetRespError(msg string)
	GetRespError() string
	SetSpace(string)
	GetSpace() string
	PlayingData(bool)
	IsPlayingData() bool
	Close()
}

func NewiCli

func NewiCli(historyFile, user string, enableGoPrompt bool) Cli

func NewnCli

func NewnCli(i io.Reader, output bool, user string, cleanup Cleanup) Cli

type GoPromptTerminal

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

func (*GoPromptTerminal) AppendHistory

func (g *GoPromptTerminal) AppendHistory(item string)

func (*GoPromptTerminal) Close

func (g *GoPromptTerminal) Close()

func (*GoPromptTerminal) Prompt

func (g *GoPromptTerminal) Prompt(p string) (string, error)

func (*GoPromptTerminal) ReadHistory

func (g *GoPromptTerminal) ReadHistory(r io.Reader) error

TODO should enhance go-prompt

func (*GoPromptTerminal) WriteHistory

func (g *GoPromptTerminal) WriteHistory(w io.Writer) error

TODO go-prompt has no interface to write history.

type LinerTerminal

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

func (*LinerTerminal) AppendHistory

func (l *LinerTerminal) AppendHistory(item string)

func (*LinerTerminal) Close

func (l *LinerTerminal) Close()

func (*LinerTerminal) Prompt

func (l *LinerTerminal) Prompt(p string) (string, error)

func (*LinerTerminal) ReadHistory

func (l *LinerTerminal) ReadHistory(r io.Reader) error

func (*LinerTerminal) WriteHistory

func (l *LinerTerminal) WriteHistory(w io.Writer) error

type Terminal

type Terminal interface {
	ReadHistory(r io.Reader) error
	AppendHistory(item string)
	WriteHistory(w io.Writer) error
	Close()
	Prompt(p string) (string, error)
}

func NewGoPromptTerminal

func NewGoPromptTerminal() Terminal

func NewLinerTerminal

func NewLinerTerminal() Terminal

Jump to

Keyboard shortcuts

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