Documentation
¶
Overview ¶
Package progress communicates and present multiple tasks progression.
A tasks leader initialize multiple progression. Each tasks defines its total, current value and progression message. Various presentation consumes progression events.
Current implementations includes CLI() for terminal and None() to discard.
Index ¶
- func Add(q int64)
- func CLI(worker func() error) (err error)
- func Clean()
- func Context(ctx context.Context, setters ...setter) (_ context.Context, done func())
- func Done() setter
- func Increment(d int) setter
- func Init(bars uint8)
- func Message(m string) setter
- func Name(n string) setter
- func None(worker func() error) error
- func Rate(r stringer) setter
- func Terminate() setter
- func ToDo(q int64) setter
- func Update(ctx context.Context, setters ...setter)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CLI ¶
CLI present progression in a tty
worker must call Clean().
Fallback to None() if stderr is not a TTY.
func Clean ¶
func Clean()
Clean flushes progression
Worker leader must always call this If Init has not been called, tells presentation to skip.
Allows calling Init() again.
func Context ¶
Context initialize bar for ctx
A progression is attached to a context. However, Update() does not lock state. You must not share context to children goroutines. Only to function in the same goroutine.
Panics if all bars have been assigned to a context. Initialize state with setters. defer done function to ensure progress is complete at end of caller.
func Init ¶
func Init(bars uint8)
Init a parallel progression
Must b called once in worker goroutine, before forking. Blocks until presentation goroutines is ready to consume progression.
Panics if another progression is tracking.
func Terminate ¶ added in v0.28.0
func Terminate() setter
Terminate marks progression as complete.
Resets Total to Current.
Types ¶
This section is empty.