Documentation
¶
Overview ¶
Package progress is how the engine says what a slow command is doing: named steps, one running at a time, and one-off notes. The CLI draws them (an animated checklist on a terminal, plain lines elsewhere); the engine never formats for a terminal. A nil Progress in the engine, or Nop, prints nothing.
Every implementation follows the same rules: starting a step finishes the running one as done (reaching the next step means the last one worked); Update, Done and Fail on an ended step do nothing; every method is safe from any goroutine.
Index ¶
- type Event
- type NoteLevel
- type Progress
- type Recorder
- func (r *Recorder) Events() []Event
- func (r *Recorder) Note(level NoteLevel, text string)
- func (r *Recorder) Notes() []string
- func (r *Recorder) Running() bool
- func (r *Recorder) Step(text string) Step
- func (r *Recorder) Steps() []string
- func (r *Recorder) String() string
- func (r *Recorder) Updates() []string
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
Event is one thing a Recorder saw. Kind is "step", "update", "done", "fail" or "note"; Level is set for notes only.
type Progress ¶
type Progress interface {
// Step starts a step; it becomes the running (spinning) line.
Step(text string) Step
// Note prints a one-off line that stays, above the running step.
Note(level NoteLevel, text string)
}
Progress receives a command's steps and notes.
func Lines ¶
Lines writes progress as plain lines, for pipes, files, CI, --json and TERM=dumb: each step's start and each note as one line, as Ghostbranch did before 6.4a. A step explicitly ended by Done or Fail prints one more line only when it carries news, that is when its text changed since it started (an Update, or a Done with a new text): "ok: <text>" or "failed: <text>". A step ended by the next step prints nothing. The prefixes are ASCII so logs stay greppable (owner, 2026-10-11; R15). Updates themselves print nothing. A nil w prints nothing.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder keeps every step, update and note in order, for tests. The zero value is ready to use.
type Step ¶
type Step interface {
// Update replaces the running step's text.
Update(text string)
// Done ends the step with a ✓. text replaces the step's text (a past
// tense, say); "" keeps it.
Done(text string)
// Fail ends the step with a ✗ and its current text.
Fail()
}
Step is one running step.