terminal

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2025 License: AGPL-3.0-or-later Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserClosed = errors.New("user closed UI")

Functions

This section is empty.

Types

type Params added in v0.0.10

type Params struct {
	EventBus           *event.Bus
	Dispatcher         func(event.Command)
	Logger             *slog.Logger
	ClipboardAvailable bool
	BuildInfo          domain.BuildInfo
	Screen             *Screen // Screen may be nil.
}

Params contains the parameters for starting a new terminal user interface.

type Screen

type Screen struct {
	Screen        tcell.Screen
	Width, Height int
	CaptureC      chan<- ScreenCapture
}

Screen represents a terminal screen. This includes its desired dimensions, which is required to initialize the tcell.SimulationScreen.

type ScreenCapture

type ScreenCapture struct {
	Cells         []tcell.SimCell
	Width, Height int
}

ScreenCapture represents a screen capture, which is used for integration testing with the tcell.SimulationScreen.

type UI

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

UI is responsible for managing the terminal user interface.

func NewUI added in v0.0.10

func NewUI(ctx context.Context, params Params) (*UI, error)

NewUI creates the user interface. Call [Run] on the *UI instance to block until it is completed.

func (*UI) Close

func (ui *UI) Close()

Close closes the terminal user interface.

func (*UI) Run added in v0.0.10

func (ui *UI) Run(ctx context.Context) error

Run runs the user interface. It always returns a non-nil error, which will be ErrUserClosed if the user voluntarily closed the UI.

func (*UI) Wait added in v0.0.10

func (ui *UI) Wait()

Wait waits for the terminal user interface to finish.

Jump to

Keyboard shortcuts

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