Documentation
¶
Overview ¶
Package output centralizes harness-owned terminal writes: human-rich vs sparse (--ai-output), and whether stderr supports carriage-return progress (TTY).
Index ¶
- type Printer
- func (p *Printer) AIOutput() bool
- func (p *Printer) ClearInline()
- func (p *Printer) HumanStderr(a ...any)
- func (p *Printer) HumanStderrWriter() io.Writer
- func (p *Printer) InlineLastLinesForTest() int
- func (p *Printer) LiveInlineProgress() bool
- func (p *Printer) RedrawInline(line string)
- func (p *Printer) SetInlineLastLinesForTest(n int)
- func (p *Printer) SetTermColumnsForTest(cols int)
- func (p *Printer) SparseStdoutln(a ...any)
- func (p *Printer) Stderrf(format string, a ...any)
- func (p *Printer) Stdoutln(a ...any)
- func (p *Printer) TermColumns() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer writes CLI messages for tools/test. Child processes (go test) still attach os.Stdout/os.Stderr directly where passthrough is intended.
func New ¶
New builds a production Printer. liveInline is enabled when stderrFD points at a real terminal and ai-output is off. Tests should use NewForTest.
func NewForTest ¶
NewForTest returns a Printer with explicit live-inline behavior. liveInline is ignored when aiOutput is true.
func NewFromApp ¶
NewFromApp uses os.Stdout/os.Stderr and stderr's TTY bit from conf.AIOutput.
func (*Printer) ClearInline ¶
func (p *Printer) ClearInline()
ClearInline clears live inline progress lines on stderr when active.
func (*Printer) HumanStderr ¶
HumanStderr writes a line to stderr when in human mode.
func (*Printer) HumanStderrWriter ¶
HumanStderrWriter returns stderr in human mode, io.Discard in AI mode. Use this for helpers that need an io.Writer (e.g. lipgloss tables, hint lines).
func (*Printer) InlineLastLinesForTest ¶ added in v0.0.5
InlineLastLinesForTest returns the tracked wrapped line count after RedrawInline.
func (*Printer) LiveInlineProgress ¶
LiveInlineProgress is true when human mode may use carriage-return redraws on stderr.
func (*Printer) RedrawInline ¶ added in v0.0.5
RedrawInline replaces the live progress block on stderr when live inline mode is active. The line should already be fitted to the terminal width by the caller.
func (*Printer) SetInlineLastLinesForTest ¶ added in v0.0.5
SetInlineLastLinesForTest sets tracked wrapped line count without a prior draw.
func (*Printer) SetTermColumnsForTest ¶ added in v0.0.5
SetTermColumnsForTest pins TermColumns/RedrawInline width (0 restores default).
func (*Printer) SparseStdoutln ¶
SparseStdoutln prints one line to stdout in AI mode (machine-oriented).
func (*Printer) TermColumns ¶ added in v0.0.5
TermColumns returns stderr width for progress fitting (defaults to 80 when unknown).