pb

package
v0.0.0-...-ee67b27 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bar

type Bar interface {
	AddToProgress(p *mpb.Progress)
	StopWithErrMsg(errMsg string)
	Stop()
}

Bar interface represents progress bar

type Progress

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

Progress represents a wrapper of github.com/vbauerster/mpb Progress with extra features

func NewProgress

func NewProgress(w io.Writer) *Progress

NewProgress creates new Progress instance. It's not possible to reuse instance after *Progress.Wait() method has been called

func NewProgressWithContext

func NewProgressWithContext(ctx context.Context, w io.Writer) *Progress

NewProgressWithContext creates new Progress instance. It's not possible to reuse instance after *Progress.Wait() method has been called

func (*Progress) AddBar

func (p *Progress) AddBar(bar Bar)

AddBar to Progress

func (*Progress) Stop

func (p *Progress) Stop()

Stop all bars with nil error

func (*Progress) Wait

func (p *Progress) Wait()

Wait waits for all bars to complete

type SpinBar

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

SpinBar represents a wrapper of github.com/vbauerster/mpb Bar with spinning progress bar that can be canceled, stopped with an error or nil

func NewSpinBar

func NewSpinBar(title string) *SpinBar

NewSpinBar returns new instance of SpinBar with title

func (*SpinBar) AddToProgress

func (sb *SpinBar) AddToProgress(p *mpb.Progress)

AddToProgress the spin bar

func (*SpinBar) Cancel

func (sb *SpinBar) Cancel()

Cancel spinning. It will be printed into progress

func (*SpinBar) Canceled

func (sb *SpinBar) Canceled() bool

Canceled returns if spin is canceled

func (*SpinBar) Error

func (sb *SpinBar) Error() error

Error returns bar error

func (*SpinBar) Stop

func (sb *SpinBar) Stop()

Stop spinning

func (*SpinBar) StopWithErrMsg

func (sb *SpinBar) StopWithErrMsg(errMsg string)

StopWithErrMsg stop spinning and print errMsg into progress

func (*SpinBar) Title

func (sb *SpinBar) Title() string

Title returns bar title

Jump to

Keyboard shortcuts

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