Documentation
¶
Index ¶
- func ClearLine()
- func InitTerminal()
- func Overwritef(format string, s ...interface{})
- func WithCallback(cb func()) augment
- func WithContext(ctx Context) augment
- func WithDebug() augment
- func WithDimensions(total, width int) augment
- func WithDisplay(start, complete, head, incomplete, end string) augment
- func WithFormat(f string) augment
- func WithLines(lines int) augment
- func WithOutput(out Output) augment
- type Bar
- func (b *Bar) Done()
- func (b *Bar) GetLines() int
- func (b *Bar) Interrupt(s string)
- func (b *Bar) Interruptf(format string, s ...interface{})
- func (b *Bar) SetFormat(f string)
- func (b *Bar) SetLines(lines int)
- func (b *Bar) String() string
- func (b *Bar) Tick()
- func (b *Bar) TickAndUpdate(ctx Context)
- func (b *Bar) Update(progress int, ctx Context)
- type Context
- type ContextValue
- type Output
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitTerminal ¶
func InitTerminal()
func Overwritef ¶
func Overwritef(format string, s ...interface{})
Overwritef clears the current line in the terminal and then performs a fmt.Printf() with the provided args
func WithCallback ¶
func WithCallback(cb func()) augment
WithCallback augments an options constructor by setting a callback
func WithContext ¶
func WithContext(ctx Context) augment
WithContext augments an options constructor by setting the initial values for the bar's context
func WithDebug ¶
func WithDebug() augment
WithDebug augments an options constructor by setting the internal debug flag to true; this will display the list of internal tokens recognized on each Tick/Update in place of the standard output
func WithDimensions ¶
func WithDimensions(total, width int) augment
WithDimensions augments an options constructor by customizing the bar's width and total
func WithDisplay ¶
func WithDisplay(start, complete, head, incomplete, end string) augment
WithDisplay augments an options constructor by customizing terminal output characters
[ xxx > ] | | | | |- end | | | |- incomplete | | |- head | |- complete |- start
func WithFormat ¶
func WithFormat(f string) augment
WithFormat augments an options constructor by customizing the bar's output format
func WithLines ¶
func WithLines(lines int) augment
WithLines augments an options constructor by setting a lines
func WithOutput ¶
func WithOutput(out Output) augment
WithOutput augments an options constructor by setting the output stream
Types ¶
type Bar ¶
type Bar struct {
// contains filtered or unexported fields
}
Bar is a progress bar to be used for displaying task progress via terminal output
func NewWithFormat ¶
NewWithFormat creates a new instance of bar.Bar with the given total and format and returns a reference to it
func NewWithOpts ¶
func NewWithOpts(opts ...func(o *barOpts)) *Bar
NewWithOpts creates a new instance of bar.Bar with the provided options and returns a reference to it
func (*Bar) Interruptf ¶
Interruptf passes the given input to fmt.Sprintf and prints it above the bar
func (*Bar) TickAndUpdate ¶
TickAndUpdate is a helper function for calling Tick followed by Update
type ContextValue ¶
type ContextValue struct {
// contains filtered or unexported fields
}
ContextValue is a tuple that defines a substitution for a custom verb
func Ctx ¶
func Ctx(verb string, value interface{}) *ContextValue
Ctx is a helper for creating a ContextValue tuple