termui

package
v0.0.0-...-412ee12 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2021 License: BSD-3-Clause, BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package termui provides objects and methods for interactive UI in terminal windows.

License

Governed by a 3-Clause BSD license. License file may be found in the root folder of this module.

Copyright © 2021 Norbert Pillmayer <norbert@pillmayer.com>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseREPL

type BaseREPL struct {
	Interpreter REPLCommandInterpreter // the interpreter this REPL runs for
	Helper      func(io.Writer)        // print out help information
	// contains filtered or unexported fields
}

BaseREPL is a base type to instantiate a REPL interpreter. Concrete REPL implementations will usually use this as a base type.

func NewBaseREPL

func NewBaseREPL(toolname, version string) *BaseREPL

NewBaseREPL create a new REPL base object intialized for an interpreter tool and a given version.

func (*BaseREPL) Outputs

func (repl *BaseREPL) Outputs() (io.Writer, io.Writer)

Outputs returns stdout and stderr of this REPL.

func (*BaseREPL) Prompt

func (repl *BaseREPL) Prompt(exitOnBye bool)

Prompt enters a REPL and executes commands. Commands are either internal administrative (setprompt, help, etc.) or interpreted statements.

type BytePipe

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

func NewBytePipe

func NewBytePipe() *BytePipe

func (*BytePipe) Close

func (bp *BytePipe) Close() error

func (*BytePipe) Reader

func (bp *BytePipe) Reader() io.Reader

func (*BytePipe) Writer

func (bp *BytePipe) Writer() io.Writer

type ChannelReader

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

func NewChannelReader

func NewChannelReader(ch <-chan byte) *ChannelReader

func (*ChannelReader) Read

func (cr *ChannelReader) Read(b []byte) (n int, err error)

type ChannelWriter

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

func NewChannelWriter

func NewChannelWriter(ch chan<- byte) *ChannelWriter

func (*ChannelWriter) Close

func (cw *ChannelWriter) Close() error

func (*ChannelWriter) Write

func (cw *ChannelWriter) Write(b []byte) (n int, err error)

type DefaultFormatter

type DefaultFormatter struct{}

func (DefaultFormatter) Format

func (df DefaultFormatter) Format(item interface{}, w io.Writer) (bool, error)

type Formatter

type Formatter interface {
	Format(interface{}, io.Writer) (bool, error)
}

type REPLCommandInterpreter

type REPLCommandInterpreter interface {
	InterpretCommand(string)
}

REPLCommandInterpreter is an interface all interpreters have to implement. It is the workhorse doing interpretation of interactive commands.

The REPL will delegate interpreting command strings (i.e. those which do not represent internal administrative commands) to the interpreter.

Jump to

Keyboard shortcuts

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