progress

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WindowDurationOption

func WindowDurationOption(dur time.Duration) func(*progressIndicator)

WindowDurationOption changes the time window size.

Types

type Manager

type Manager struct {
	syncutil.RWMutex
	// contains filtered or unexported fields
}

Manager is used to maintain the progresses we care about.

func NewManager

func NewManager() *Manager

NewManager creates a new Manager.

func (*Manager) AddProgress

func (m *Manager) AddProgress(progress string, current, total float64, updateInterval time.Duration, opts ...Option) (exist bool)

AddProgress adds a progress into manager if it doesn't exist.

func (*Manager) GetProgresses

func (m *Manager) GetProgresses(filter func(p string) bool) []string

GetProgresses gets progresses according to the filter.

func (*Manager) RemoveProgress

func (m *Manager) RemoveProgress(progress string) (exist bool)

RemoveProgress removes a progress from manager.

func (*Manager) Reset

func (m *Manager) Reset()

Reset resets the progress manager.

func (*Manager) Status

func (m *Manager) Status(progressName string) (progress, leftSeconds, currentSpeed float64, err error)

Status returns the current progress status of a give name.

func (*Manager) UpdateProgress

func (m *Manager) UpdateProgress(progress string, current, remaining float64, isInc bool, opts ...Option)

UpdateProgress updates the progress if it exists.

func (*Manager) UpdateProgressTotal

func (m *Manager) UpdateProgressTotal(progress string, total float64)

UpdateProgressTotal updates the total value of a progress if it exists.

type Option

type Option func(*progressIndicator)

Option is used to do some action for progressIndicator.

Jump to

Keyboard shortcuts

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