Documentation
¶
Overview ¶
Package progress ships a TTY progress reporter and two actions that publish progress events through kernel/xctx.
The reporter is installed once per pipeline via WrapPipeline. Any action can publish xctx.ReportProgress; the reporter renders it. When stderr is a TTY, long-running steps show an animated spinner with elapsed time. When stderr is redirected, one line per completed step is written so CI logs stay readable.
Typical use:
@require progress
{ duration_ms: 2000 }
-> progress.wrap @{ action: runtime.sleep, message: "Slow op" }
-> progress.step @{ message: "Ready" }
Index ¶
Constants ¶
const ID = "progress"
Variables ¶
This section is empty.
Functions ¶
func StepAction ¶
StepAction renders one progress line and passes its input through unchanged, minus the message key.
{ x: 1 } -> progress.step @{ message: "Loading" } -> { y: 2 }
After step runs, the pipeline sees { x: 1 }.
func WrapAction ¶
WrapAction resolves its target through the execution resolver and runs the target inside a progress lifecycle. The target receives every field of the wrap input except the wrap-specific keys "action" and "message".
{ duration_ms: 2000 }
-> progress.wrap @{ action: runtime.sleep, message: "Slow op" }
Types ¶
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter renders xctx.Progress events to a writer. It is safe for concurrent use and safe to Shutdown more than once.
func NewReporter ¶
NewReporter returns a Reporter writing to out. A nil writer falls back to os.Stderr. The Reporter detects TTY-ness once at construction.
func (*Reporter) Report ¶
Report implements xctx.ProgressReporter.
Events are dispatched on Metadata["kind"]:
"step" — one-shot progress line; current/total are ignored "wrap" — lifecycle event; Current==0 starts, Current>=Total ends
A bare Progress with a Message and no kind is rendered as a step, so callers who publish xctx.Progress directly get visible output without having to know this package's metadata convention.