screen

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package screen drives loupe's full-screen programs the way a human at a terminal does: keys go in through a pipe, and each step waits for the screen to show its result rather than for time to pass, so a test never races the program, however slowly a step such as publishing runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Screen

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

func Start

func Start(t testing.TB, width, height int, fn func(stdin io.Reader, stdout, stderr io.Writer) int) *Screen

Start runs fn on its own goroutine. fn reads the keys Screen sends from stdin, and everything it writes to stdout or stderr is what the screen shows.

func (*Screen) Press

func (s *Screen) Press(names ...string)

Press sends each named key on its own: a key from the keys table, or a single character.

func (*Screen) Running

func (s *Screen) Running() bool

Running reports whether the program has yet to end.

func (*Screen) Type

func (s *Screen) Type(text string)

Type sends text in one write, as fast typing or a paste arrives.

func (*Screen) View

func (s *Screen) View() string

View returns the last completed frame with terminal controls interpreted.

func (*Screen) Wait

func (s *Screen) Wait() (stdout, stderr string, exit int)

Wait returns once the program ends, with everything it wrote and its exit code.

func (*Screen) WaitFor

func (s *Screen) WaitFor(want ...string) string

WaitFor returns a fresh completed frame that contains every requested string. It fails if the program ends first.

Jump to

Keyboard shortcuts

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