steps

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package steps shows a task as a list of steps the way `docker buildx` does: the running step streams its output in a small scrolling window, and folds to one line with its duration when it finishes.

On a terminal the view is redrawn in place. Finished steps are printed once above the live area and never redrawn. Off a terminal, every line is printed once, prefixed with its step.

Index

Constants

View Source
const DefaultLines = 12

DefaultLines is the height of a running step's log window.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	TTY     bool // redraw in place
	Color   bool
	Lines   int  // log window height; DefaultLines if 0
	Verbose bool // print every line of finished steps, not just their summary
}

Options configure a View.

type Step

type Step struct {
	// contains filtered or unexported fields
}

Step is one step of a View. Its Write method takes the step's output; complete lines go into its log, escape sequences stripped.

func (*Step) Done

func (s *Step) Done(summary string)

Done marks the step finished, with a short summary for its line.

func (*Step) Fail

func (s *Step) Fail(err error)

Fail marks the step failed; its last lines stay on screen.

func (*Step) Logf

func (s *Step) Logf(format string, args ...any)

Logf adds one formatted line to the step's log.

func (*Step) Start

func (s *Step) Start() *Step

Start marks the step running and returns it.

func (*Step) Write

func (s *Step) Write(p []byte) (int, error)

Write adds output to the step's log; a line is taken when its newline arrives.

type View

type View struct {
	// contains filtered or unexported fields
}

View is a list of steps.

func New

func New(w io.Writer, opt Options, titles ...string) *View

New starts a view on w listing titles as pending steps; more can be added with Step.

func (*View) Close

func (v *View) Close()

Close draws the final state and stops redrawing. A step still running is shown as stopped; pending steps are dropped.

func (*View) Remove

func (v *View) Remove(titles ...string)

Remove drops pending steps that turned out not to apply.

func (*View) Step

func (v *View) Step(title string) *Step

Step returns the step with title, adding it as pending if there's none. Titles are unique within a view.

Jump to

Keyboard shortcuts

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