progress

package
v3.8.3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AutoClose      proFlag = 1 << iota // if set, progress will close when all bars done
	ForbiddenWrite                     // if set, progress will if forbidden other goroutine print to Stdout through os.Stdout
)

Variables

View Source
var Running = make(chan struct{}, 1)

Running used to record whether there is a progress currently running. Only one progress is allowed to run at the same time.

Functions

This section is empty.

Types

type Bar

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

func NewBar

func NewBar(name string, now, total int, ifRemove bool) *Bar

func NewRemoveBar

func NewRemoveBar(name string, now, total int) *Bar

type Progress

type Progress struct {
	Bars        []*Bar
	MaxPrintBar int // The maximum number of bars to print; any excess will be recorded but not displayed.
	// contains filtered or unexported fields
}

func FuncBarPrint

func FuncBarPrint(ctx context.Context, name string, gr *reerrgroup.Group, now, total int) *Progress

func FuncNameBarPrint

func FuncNameBarPrint(ctx context.Context, gr *reerrgroup.Group, now, total int) *Progress

func NewProgress

func NewProgress(mode proFlag, m int) *Progress

func Start

func Start(bar ...*Bar) *Progress

func StartWithMode

func StartWithMode(mode proFlag, bar ...*Bar) *Progress

func (*Progress) AddBar

func (p *Progress) AddBar(bs ...*Bar)

func (*Progress) IncBar

func (p *Progress) IncBar(bs ...*Bar)

func (*Progress) IsStopped

func (p *Progress) IsStopped() bool

func (*Progress) SetBarNow

func (p *Progress) SetBarNow(b *Bar, now int)

func (*Progress) SetMaxPrintBar

func (p *Progress) SetMaxPrintBar(n int)

func (*Progress) Start

func (p *Progress) Start()

func (*Progress) Stop

func (p *Progress) Stop()

Jump to

Keyboard shortcuts

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