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 ¶
- func New(t theme.Theme) screen.Screen
- type Screen
- func (s *Screen) Help() []key.Binding
- func (s *Screen) Init() tea.Cmd
- func (s *Screen) IsCapturingKeys() bool
- func (s *Screen) Layout() layout.Node
- func (s *Screen) OnEnter(result any) tea.Cmd
- func (s *Screen) SetTheme(t theme.Theme)
- func (s *Screen) Title() string
- func (s *Screen) Update(msg tea.Msg) (screen.Screen, tea.Cmd)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
func (*Screen) IsCapturingKeys ¶
func (*Screen) OnEnter ¶
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.