progress

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package progress provides a minimal reporter interface for the scanner to emit host-level progress updates. A TTY-backed implementation renders a progress bar on stderr using github.com/schollz/progressbar/v3; the Noop implementation is used when stderr is not a TTY so piping JSON/grep output stays clean.

Reporters are goroutine-safe (schollz/progressbar is), so the scanner can call them from its per-host workers without extra locking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reporter

type Reporter interface {
	// SetTotal declares the expected total count when known. Calling with
	// a non-positive value switches the reporter to indeterminate mode.
	SetTotal(n int64)
	// Tick records one unit of progress.
	Tick()
	// Finish flushes any trailing output (newline after the bar).
	Finish()
}

Reporter emits progress updates. All methods must be safe for concurrent use from scanner workers.

func New

func New(description string, force bool) Reporter

New returns a stderr-backed bar when stderr is a TTY, otherwise Noop. Options:

  • description shown before the bar (e.g., "scanning")
  • force: when true, emit the bar even if stderr is not a TTY (useful for tests / logs). force=false is the normal runtime path.

func NewFor

func NewFor(w io.Writer, description string) Reporter

NewFor returns a bar that writes to the given io.Writer, typed for tests.

func NewNoop

func NewNoop() Reporter

NewNoop returns a Reporter that discards all updates.

Jump to

Keyboard shortcuts

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