faketerm

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package faketerm is a fake implementation of the terminal for the use in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(want, got *Terminal) string

Diff compares the two terminals, returning an empty string if there is not difference. If a difference is found, returns a human readable description of the differences.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is used to provide options.

func WithEventQueue

func WithEventQueue(eq *eventqueue.Unbound) Option

WithEventQueue provides a queue of events. One event will be consumed from the queue each time Event() is called. If not provided, Event() returns an error on each call.

type Terminal

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

Terminal is a fake terminal. This implementation is thread-safe.

func MustNew

func MustNew(size image.Point, opts ...Option) *Terminal

MustNew is like New, but panics on all errors.

func New

func New(size image.Point, opts ...Option) (*Terminal, error)

New returns a new fake Terminal.

func (*Terminal) Area

func (t *Terminal) Area() image.Rectangle

Area returns the area of the fake terminal.

func (*Terminal) BackBuffer

func (t *Terminal) BackBuffer() buffer.Buffer

BackBuffer returns the back buffer of the fake terminal.

func (*Terminal) Clear

func (t *Terminal) Clear(opts ...cell.Option) error

Clear implements terminalapi.Terminal.Clear.

func (*Terminal) Close

func (t *Terminal) Close()

Close closes the terminal. This is a no-op on the fake terminal.

func (*Terminal) Event

func (t *Terminal) Event(ctx context.Context) terminalapi.Event

Event implements terminalapi.Terminal.Event.

func (*Terminal) Flush

func (t *Terminal) Flush() error

Flush implements terminalapi.Terminal.Flush.

func (*Terminal) HideCursor

func (t *Terminal) HideCursor()

HideCursor implements terminalapi.Terminal.HideCursor.

func (*Terminal) Resize

func (t *Terminal) Resize(size image.Point) error

Resize resizes the terminal to the provided size. This also clears the internal buffer.

func (*Terminal) SetCell

func (t *Terminal) SetCell(p image.Point, r rune, opts ...cell.Option) error

SetCell implements terminalapi.Terminal.SetCell.

func (*Terminal) SetCursor

func (t *Terminal) SetCursor(p image.Point)

SetCursor implements terminalapi.Terminal.SetCursor.

func (*Terminal) Size

func (t *Terminal) Size() image.Point

Size implements terminalapi.Terminal.Size.

func (*Terminal) String

func (t *Terminal) String() string

String prints out the buffer into a string. This includes the cell runes only, cell options are ignored. Implements fmt.Stringer.

Jump to

Keyboard shortcuts

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