Documentation ¶
Index ¶
- Variables
- func Download(uri string, w io.Writer) error
- func RenderRainbow(w io.Writer, current, total int)
- func RenderSimple(w io.Writer, current, total int)
- func StatsAmountComplete(current int64, total int64, _ float64, _ History) string
- func StatsAmountRate(_ int64, total int64, _ float64, h History) string
- func StatsBytesComplete(current int64, total int64, _ float64, _ History) string
- func StatsBytesRate(_ int64, _ int64, _ float64, h History) string
- func StatsPercentComplete(_ int64, total int64, fraction float64, _ History) string
- func StatsTimeRemaining(_ int64, total int64, _ float64, h History) string
- type Bar
- func (b *Bar) AddCurrent(add int) *Bar
- func (b *Bar) AddCurrentInt64(current int64) *Bar
- func (b *Bar) Finish()
- func (b *Bar) Increment()
- func (b *Bar) Log(format string, args ...interface{}) *Bar
- func (b *Bar) SetCurrent(current int) *Bar
- func (b *Bar) SetCurrentInt64(current int64) *Bar
- func (b *Bar) SetLabel(label string) *Bar
- func (b *Bar) SetTotal(total int) *Bar
- func (b *Bar) SetTotalInt64(total int64) *Bar
- func (b *Bar) Write(p []byte) (n int, err error)
- type History
- type Option
- func OptionHideOnFinish(enabled bool) Option
- func OptionWithAutoComplete(enabled bool) Option
- func OptionWithLabel(l string) Option
- func OptionWithPadding(padding int) Option
- func OptionWithRenderFunc(r RenderFunc) Option
- func OptionWithStatsFuncs(f ...StatsFunc) Option
- func OptionWithStatsPadding(padding int) Option
- func OptionWithWriter(w io.Writer) Option
- func OptionWithoutStatsFuncs() Option
- type Record
- type RenderFunc
- type StatsFunc
Constants ¶
This section is empty.
Variables ¶
var RenderColored = RenderColoured
RenderColored is an alias for RenderColoured
Functions ¶
func RenderRainbow ¶
RenderRainbow renders a rectangular progress bar that cycles through colours as it progresses across the terminal
func RenderSimple ¶
RenderSimple renders a simple rectangular progress bar using the default terminal colours
func StatsAmountComplete ¶
func StatsBytesComplete ¶
func StatsPercentComplete ¶
Types ¶
type Bar ¶
Bar is a loading bar
func (*Bar) AddCurrent ¶
AddCurrent adds the given value to the current value of the bar
func (*Bar) AddCurrentInt64 ¶
AddCurrentInt64 adds the given int64 value to the current value of the bar
func (*Bar) Finish ¶
func (b *Bar) Finish()
Finish finishes processing on the bar, and restores the terminal state e.g. cursor visibility You don't need to call this unless:
A. You want to stop the bar before it completes B. Your bar has an unknown (zero) total and thus cannot know when it is complete
func (*Bar) SetCurrent ¶
SetCurrent sets the current value of the bar
func (*Bar) SetCurrentInt64 ¶
SetCurrentInt64 sets the current value of the bar with an int64
func (*Bar) SetLabel ¶
SetLabel sets the label displayed at the start of the bar (this can be used to update the label during rendering)
func (*Bar) SetTotalInt64 ¶
SetTotalInt64 sets the total value of the bar with an int64
type Option ¶
type Option func(b *Bar)
Option is a customisation function that modifies a Bar
func OptionHideOnFinish ¶
OptionHideOnFinish hides the bar when it is finished
func OptionWithAutoComplete ¶
OptionWithAutoComplete sets whether the bar should automatically complete when the total is reached
func OptionWithLabel ¶
OptionWithLabel sets the label for the bar (displayed to the left)
func OptionWithPadding ¶
OptionWithPadding sets the number of spaces to the left and right of the entire bar
func OptionWithRenderFunc ¶
func OptionWithRenderFunc(r RenderFunc) Option
OptionWithRenderFunc sets the render function for the bar
func OptionWithStatsFuncs ¶
OptionWithStatsFuncs sets the stats functions for the bar
func OptionWithStatsPadding ¶
OptionWithStatsPadding sets the number of spaces between the graphical bar and the stats segments
func OptionWithWriter ¶
OptionWithWriter sets the writer for the bar
func OptionWithoutStatsFuncs ¶
func OptionWithoutStatsFuncs() Option
OptionWithoutStatsFuncs removes all stats functions from the bar
type RenderFunc ¶
RenderFunc is a function that renders the graphical portion of the progress bar
func RenderColoured ¶
func RenderColoured(r, g, b int) RenderFunc
RenderColoured renders a progress bar in the given rgb colour
func RenderCustomCharacters ¶
func RenderCustomCharacters(complete rune, incomplete rune) RenderFunc
RenderCustomCharacters renders a simple rectangular progress bar using the supplied characters