reporter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package reporter holds the engine.Reporter implementations the CLI picks between at startup. There are two: PlainReporter for non-TTY use (CI, pipes, `NO_COLOR`, `--no-color`) and TTYReporter for interactive shells. The choice is made by Select and returned as the opaque engine.Reporter interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Select

func Select(opts Options) engine.Reporter

Select returns a reporter appropriate for the current environment. TTYReporter when Out is a terminal and neither NO_COLOR nor ForcePlain is set; PlainReporter otherwise.

Types

type Options

type Options struct {
	// Out is the writer for user-visible output. Defaults to os.Stdout.
	Out io.Writer

	// ForcePlain forces PlainReporter regardless of TTY / env.
	// Wired to the --no-color CLI flag.
	ForcePlain bool
}

Options controls reporter selection. Zero value selects automatically from the environment.

type PlainReporter

type PlainReporter struct {
	Out io.Writer
}

PlainReporter prints machine-friendly lines with no color or alignment. Used when stdout is a pipe, in CI, when NO_COLOR is set, or when --no-color is explicit. Output is intended to be greppable and stable across runs.

func (*PlainReporter) NodeCompleted

func (r *PlainReporter) NodeCompleted(nodeID string, _ map[string]cty.Value, d time.Duration)

NodeCompleted implements engine.Reporter.

func (*PlainReporter) NodeFailed

func (r *PlainReporter) NodeFailed(nodeID string, err error)

NodeFailed implements engine.Reporter.

func (*PlainReporter) NodeStarted

func (r *PlainReporter) NodeStarted(string)

NodeStarted implements engine.Reporter. Plain reporter stays silent on start — the completion line carries the timing and is enough signal for log consumers.

func (*PlainReporter) RunCompleted

func (r *PlainReporter) RunCompleted(s engine.RunSummary)

RunCompleted implements engine.Reporter.

func (*PlainReporter) RunStarted

func (r *PlainReporter) RunStarted(scenario string)

RunStarted implements engine.Reporter.

type TTYReporter

type TTYReporter struct {
	Out io.Writer
}

TTYReporter produces styled output for interactive shells. Uses lipgloss via internal/cli/render; auto-degrades on terminals that don't support color via termenv.

func (*TTYReporter) NodeCompleted

func (r *TTYReporter) NodeCompleted(nodeID string, _ map[string]cty.Value, d time.Duration)

NodeCompleted implements engine.Reporter.

func (*TTYReporter) NodeFailed

func (r *TTYReporter) NodeFailed(nodeID string, err error)

NodeFailed implements engine.Reporter.

func (*TTYReporter) NodeStarted

func (r *TTYReporter) NodeStarted(string)

NodeStarted implements engine.Reporter. Currently silent — adding a pre-completion line is where live-progress would hook in; deferred for now.

func (*TTYReporter) RunCompleted

func (r *TTYReporter) RunCompleted(s engine.RunSummary)

RunCompleted implements engine.Reporter.

func (*TTYReporter) RunStarted

func (r *TTYReporter) RunStarted(scenario string)

RunStarted implements engine.Reporter.

Jump to

Keyboard shortcuts

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