progress

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressReporter

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

func NewProgressReporter

func NewProgressReporter(total uint32, description string) *ProgressReporter

NewProgressReporter returns a new ProgressReporter with a progress bar that has the given total and description. The progress bar is configured with default options and a custom theme that displays a progress bar with a solid block (█) for the completed portion, a hollow block (░) for the remaining portion, a vertical bar (│) for the bar start and end, and a space ( ) for the bar padding. The progress bar also displays the count of items completed, the total count of items, the elapsed time, and an estimate of the remaining time.

func (*ProgressReporter) Finish

func (pr *ProgressReporter) Finish()

Finish marks the progress bar as finished and prints the total elapsed time.

func (*ProgressReporter) GetProgress

func (pr *ProgressReporter) GetProgress() (uint32, uint32)

GetProgress returns the current progress and total number of units.

Returns:

A tuple containing the current progress and total number of units.

func (*ProgressReporter) Update

func (pr *ProgressReporter) Update(increment uint32) error

func (*ProgressReporter) UpdateWithMessage

func (pr *ProgressReporter) UpdateWithMessage(increment uint32, message string) error

UpdateWithMessage increments the progress bar and updates the current count. The progress bar is advanced by the specified increment and the description is updated with the given message.

Parameters:

increment - The number of units to increment the progress by.
message - The message to display in the progress bar.

Returns:

An error if the progress bar fails to update.

Jump to

Keyboard shortcuts

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