progress

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildProgressBar

func BuildProgressBar(currentSteps, totalSteps int32, status Status, width int) string

BuildProgressBar creates a Unicode progress bar string Ported from existing buildProgressBar and currentProgressBar functions

func CalculateETA

func CalculateETA(elapsed time.Duration, currentSteps, totalSteps int32) time.Duration

CalculateETA estimates time remaining based on linear extrapolation Ported from existing calculateETA function

func FormatTime

func FormatTime(d time.Duration) string

FormatTime formats a duration as MM:SS Ported from existing formatTime function

Types

type Status

type Status int
const (
	StatusProcessing Status = iota
	StatusError
	StatusOK
)

func NewStatus

func NewStatus(progressing, hasError bool) Status

type Tracker

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

Tracker encapsulates all progress tracking state with thread-safe access

func NewTracker

func NewTracker(totalSteps int32) *Tracker

NewTracker creates a new progress tracker

func (*Tracker) Finish

func (t *Tracker) Finish()

Finish marks the tracking as complete

func (*Tracker) GetCurrentSteps

func (t *Tracker) GetCurrentSteps() int32

GetCurrentSteps returns the current step count

func (*Tracker) GetElapsed

func (t *Tracker) GetElapsed() time.Duration

GetElapsed returns elapsed time (uses endTime if finished, otherwise calculates from now)

func (*Tracker) GetStartTime

func (t *Tracker) GetStartTime() time.Time

GetStartTime returns when tracking started

func (*Tracker) GetStatusMessage

func (t *Tracker) GetStatusMessage() string

GetStatusMessage returns the current status message

func (*Tracker) GetTotalSteps

func (t *Tracker) GetTotalSteps() int32

GetTotalSteps returns the total step count

func (*Tracker) HasError

func (t *Tracker) HasError() bool

HasError returns whether an error has occurred

func (*Tracker) IncrementStep

func (t *Tracker) IncrementStep(statusMsg string)

IncrementStep increments the progress counter and updates status message

func (*Tracker) SetError

func (t *Tracker) SetError()

SetError marks that an error has occurred

Jump to

Keyboard shortcuts

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