output

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package output demonstrates the app-wide output console: everything the app has said, kept, and readable long after the statusbar wiped it.

The problem it solves is visible from this screen. Pick "Deploy fails with a wrapped error" and watch the footer: you get one truncated line, and it is gone on the next keypress. The full %w chain never had anywhere to go. Press "o" and it is all still there.

Four things feed the console, and this screen exercises all of them:

  • app.Info / app.Error — captured automatically, no code change needed.
  • app.InfoDetail / app.ErrorDetail — summary to the bar, body to the log.
  • app.ErrorOf — the %w chain, one wrap per line, without hand-formatting.
  • runner.Capture — a subprocess whose stdout/stderr stream into the log while the TUI stays live. Start the 30-second one and keep navigating; the badge shows ⟳ while it runs, and "x" on the console kills it.

The console is opt-in: none of it exists unless app.Options.OutputKey is set. See examples/launcher/main.go, which sets it for the whole suite.

Note OnEnter: closing the console pops with app.OutputClosed, and a screen whose OnEnter starts a fetch has to say so, or glancing at a log silently refetches whatever was underneath.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(t theme.Theme) screen.Screen

New returns the output-console demo screen.

Types

type Screen

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

func (*Screen) Help

func (s *Screen) Help() []key.Binding

func (*Screen) Init

func (s *Screen) Init() tea.Cmd

func (*Screen) IsCapturingKeys

func (s *Screen) IsCapturingKeys() bool

func (*Screen) Layout

func (s *Screen) Layout() layout.Node

func (*Screen) OnEnter

func (s *Screen) OnEnter(result any) tea.Cmd

OnEnter guards against the console.

A pop hands OnEnter a result, and there is no way to tell "I was just pushed" from "someone glanced at a log" except by looking at it. Screens that fetch on activation — most of them — need this branch, or opening the console becomes an accidental refresh of whatever was underneath.

func (*Screen) SetTheme

func (s *Screen) SetTheme(t theme.Theme)

func (*Screen) Title

func (s *Screen) Title() string

Title is "Console" rather than "Output" so the breadcrumb reads "Examples › Console › Output" when the log is open, instead of the same word twice.

func (*Screen) Update

func (s *Screen) Update(msg tea.Msg) (screen.Screen, tea.Cmd)

Jump to

Keyboard shortcuts

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