console

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package console renders engine progress at the CLI edge. It implements the clog-free progress.Reporter seam with a clog live display, so the pipeline and pure core stay free of any terminal dependency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Reporter)

Option configures a Reporter.

func WithInfer

func WithInfer(on bool) Option

WithInfer marks the run as inference-driven: a tree carrying no clover: comments is the expected input there, so Discovered reports it as information rather than a warning.

type Reporter

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

Reporter renders overall resolution progress as a single live line carrying a progress=done/total field. On a TTY clog updates the line in place; off a TTY (CI, pipes) it is suppressed entirely, since a progress line that never animates is just noise there. The per-marker detail the seam reports is aggregated into the one counter for now; a richer per-marker view can be added later without changing the seam.

func New

func New(ctx context.Context, logger *clog.Logger, opts ...Option) *Reporter

New returns a Reporter rendering through logger, which the CLI configures (typically clog.Default writing to stderr).

func (*Reporter) Begin

func (r *Reporter) Begin(names []string) ([]progress.Task, func())

Begin starts one progress line totalling len(names) and returns a task per name, every one advancing the same counter as it reaches a terminal state. The returned wait blocks until the line has finished rendering.

func (*Reporter) Discovered

func (r *Reporter) Discovered(scanned, files, comments int)

Discovered logs the scan totals before resolution begins, or warns when no Clover comments were found at all.

func (*Reporter) Track

func (r *Reporter) Track(label, field string, total int) progress.Tracker

Track starts the transient progress line labelled label and returns a handle the work drives with its running count. On a TTY clog animates a spinner carrying the live count - an open field=n when total is zero, a field=n/total fraction (with the resolve line's gradient) when it is positive - erased when the handle stops so the next log line supplants it; off a TTY (NonTTYSilent) it renders nothing.

Jump to

Keyboard shortcuts

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