ui

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 10 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

Index

Constants

View Source
const CatchPhrase = "Every release deserves a héraut."

CatchPhrase is the tagline displayed under the logo.

Variables

This section is empty.

Functions

func Err added in v0.8.0

func Err(w io.Writer, msg string) string

Err returns "✗ <msg>" styled red when w supports color, plain otherwise.

func Header(w io.Writer, title string)

Header writes a bold section title to w, surrounded by blank lines. Used to separate config / runtime / cliff sections in heraut check.

func HelpLong

func HelpLong() string

HelpLong returns the ASCII art + tagline for use as cobra root.Long.

func Info added in v0.8.0

func Info(w io.Writer, msg string) string

Info returns " <msg>" dimmed when w supports color, plain otherwise. Use for hints and supplementary context below a primary status line.

func Success added in v0.8.0

func Success(w io.Writer, msg string) string

Success returns "✓ <msg>" styled green when w supports color, plain otherwise.

func VersionTemplate

func VersionTemplate() string

VersionTemplate returns a cobra text/template string for --version output. cobra fills {{.Name}} and {{.Version}} at runtime.

func Warn added in v0.8.0

func Warn(w io.Writer, msg string) string

Warn returns "! <msg>" styled yellow when w supports color, plain otherwise. Use for skipped checks and non-critical notices.

Types

type Progress added in v0.11.0

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

Progress runs a sequence of named pipeline steps, labelling each one with a N/total counter and an animated spinner in TTY environments.

Non-TTY writers (CI, pipes, dry-run) automatically fall back to plain lines through the existing StartStep → StartPlainStep detection in step.go.

func NewProgress added in v0.11.0

func NewProgress(out io.Writer, total int) *Progress

NewProgress constructs a Progress that writes to out and labels each step N/total. total may be 0 when the caller cannot pre-compute the count; steps then render as N/0, which is a degraded-but-non-crashing state.

func (*Progress) Step added in v0.11.0

func (p *Progress) Step(name string, fn func() (result string, subs []string, err error)) error

Step wraps one named pipeline step. It satisfies StepFn.

If fn is nil, Step completes immediately as a successful no-op.

type Step added in v0.9.0

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

Step represents a single named check or pipeline step. In TTY environments it shows an animated spinner while the work runs, then replaces it with a final status line. In non-TTY (CI, pipe, dry-run) it falls back to plain text so log files stay readable.

func StartPlainStep added in v0.9.0

func StartPlainStep(out io.Writer, msg string) *Step

StartPlainStep always uses plain lines regardless of terminal. Use in dry-run mode where output lines must not be overwritten by the spinner.

func StartStep added in v0.9.0

func StartStep(out io.Writer, msg string) *Step

StartStep begins a step with automatic TTY detection. Animates a spinner when the writer is a terminal, falls back to plain text otherwise.

func (*Step) Done added in v0.9.0

func (s *Step) Done(result string)

Done completes the step successfully. Prints "✓ step name — result" (or "✓ step name" when result is empty).

func (*Step) Fail added in v0.9.0

func (s *Step) Fail(detail string)

Fail completes the step with a failure. Prints "✗ step name — first_line" with any additional lines indented beneath.

func (*Step) Skip added in v0.9.0

func (s *Step) Skip(detail string)

Skip completes the step as an advisory warning (IsWarn=true). Prints "! step name — detail".

type StepFn added in v0.11.0

type StepFn func(name string, fn func() (result string, subs []string, err error)) error

StepFn is the type of a function that wraps one named pipeline step. name is shown while the step is running and on the completion line. fn performs the work. It returns:

  • result: shown as "✓ N/M name — result" when non-empty; omitted otherwise
  • subs: zero or more sub-result labels, each printed as an indented " ✓ label" line beneath the parent completion line
  • err: step failure; the reporter renders "✗ N/M name — err"

When the StepFn field on a pipeline is nil, the pipeline calls fn directly and discards result and subs — existing behaviour preserved, tests unaffected.

Jump to

Keyboard shortcuts

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