progress

package
v2.0.0-alpha.33 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FmtPrinter

type FmtPrinter struct{}

FmtPrinter is the default Printer implementation using fmt. It prints to stdout.

func NewFmtPrinter

func NewFmtPrinter() *FmtPrinter

NewFmtPrinter creates a new FmtPrinter.

func (*FmtPrinter) PrintWithoutNewline

func (p *FmtPrinter) PrintWithoutNewline(text string)

PrintWithoutNewline prints text to stdout without a newline.

func (*FmtPrinter) Println

func (p *FmtPrinter) Println()

Println prints a newline to stdout.

type Printer

type Printer interface {
	// PrintWithoutNewline prints text without adding a newline.
	PrintWithoutNewline(text string)

	// Println prints a newline.
	Println()
}

Printer defines the interface for printing to output. This abstraction allows injecting custom output implementations for testing or directing output to different destinations.

type SimpleDots

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

SimpleDots provides periodic output for long-running operations in CI environments. It prints dots at regular intervals to show that work is progressing.

func NewDefaultSimpleDots

func NewDefaultSimpleDots(printer Printer) *SimpleDots

NewDefaultSimpleDots creates a SimpleDots with a default 5-second interval.

func NewSimpleDotsWithInterval

func NewSimpleDotsWithInterval(interval time.Duration, printer Printer) *SimpleDots

NewSimpleDotsWithInterval creates a new SimpleDots with the given interval.

func NewSimpleDotsWithTicker

func NewSimpleDotsWithTicker(printer Printer, ticker Ticker) *SimpleDots

NewSimpleDotsWithTicker creates a new SimpleDots with a custom Ticker for testing.

func (*SimpleDots) Run

func (t *SimpleDots) Run(action func() error) error

Run starts the progress dots and executes the given action.

type Ticker

type Ticker interface {
	Chan() <-chan time.Time
	Stop()
}

Ticker helps with mocking time.Ticker by hiding exported struct fields

func NewTicker

func NewTicker(d time.Duration) Ticker

NewTicker creates a new Ticker with the given duration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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