rline

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2017 License: MIT Imports: 6 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInterrupt is the interrupt error.
	ErrInterrupt = readline.ErrInterrupt

	// ErrNotInteractive is the not interactive error.
	ErrNotInteractive = errors.New("not interactive")
)

Functions

This section is empty.

Types

type IO

type IO interface {
	// Next returns the next line of runes (excluding '\n') from the input.
	Next() ([]rune, error)

	// Close closes the IO.
	Close() error

	// Stdout is the IO's standard out.
	Stdout() io.Writer

	// Stderr is the IO's standard error out.
	Stderr() io.Writer

	// Interactive determines if the IO is an interactive terminal.
	Interactive() bool

	// Cygwin determines if the IO is a Cygwin interactive terminal.
	Cygwin() bool

	// Prompt sets the prompt for the next interactive line read.
	Prompt(string)

	// Save saves a line of history.
	Save(string) error

	// Password prompts for a password.
	Password() (string, error)

	// ForceIntCyg forces the interactive and cygwin values.
	ForceIntCyg(bool, bool)
}

IO is the common input/output interface.

func New

func New(cmds []string, in, out string, histfile string) (IO, error)

New creates a new readline input/output handler.

type Rline

type Rline struct {
	N func() ([]rune, error)
	C func() error
	//In  io.Reader
	Out io.Writer
	Err io.Writer
	Int bool
	Cyg bool
	P   func(string)
	S   func(string) error
	Pw  func() (string, error)
}

Rline provides a type compatible with the IO interface.

func (*Rline) Close

func (l *Rline) Close() error

Close closes the IO.

func (*Rline) Cygwin

func (l *Rline) Cygwin() bool

Cygwin determines if the IO is a Cygwin interactive terminal.

func (*Rline) ForceIntCyg

func (l *Rline) ForceIntCyg(interactive, cygwin bool)

ForceIntCyg forces the interactive and cygwin values.

func (*Rline) Interactive

func (l *Rline) Interactive() bool

Interactive determines if the IO is an interactive terminal.

func (*Rline) Next

func (l *Rline) Next() ([]rune, error)

Next returns the next line of runes (excluding '\n') from the input.

func (*Rline) Password

func (l *Rline) Password() (string, error)

Password prompts for a password.

func (*Rline) Prompt

func (l *Rline) Prompt(s string)

Prompt sets the prompt for the next interactive line read.

func (*Rline) Save

func (l *Rline) Save(s string) error

Save saves a line of history.

func (*Rline) Stderr

func (l *Rline) Stderr() io.Writer

Stderr is the IO's standard error out.

func (*Rline) Stdout

func (l *Rline) Stdout() io.Writer

Stdout is the IO's standard out.

Jump to

Keyboard shortcuts

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