Documentation ¶
Overview ¶
Package progress allows to easily create a progressbar by simply providing the total and the completed parts.
Example ¶
The easiest way to get a progressbar is as follows
var p Progress p.GetBar(275, 346)
Output:
Example (CustomStyle) ¶
Using a custom style is as simple as adding it and changing to it
var p Progress DefineStyle("my-style", []string{"○", "◔", "◑", "◕", "●"}) p.SetStyle("my-style") p.GetBar(275, 346)
Output:
Example (Styled) ¶
Changing the Style is not hard, in fact it's quite easy
var p Progress p.SetStyle("parallelogram") p.GetBar(275, 346)
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ProgressStyles = map[string][]string{ "double": []string{" ", "="}, "double-": []string{" ", "-", "="}, "single": []string{" ", "-"}, "parallelogram": []string{"▱", "▰"}, "spaced-blocks": []string{"▯", "▮"}, "block": []string{" ", "▏", "▎", "▍", "▌", "▋", "▊", "▉", "█"}, "": []string{" ", "="}, }
ProgressStyles contains the styles of the progressbars. Custom styles can easily be appended and used.
Functions ¶
func DefineStyle ¶
DefineStyle allows registering a custom progress-style to use. If the name is already defined it is overwritten. Directly defining it is possible but not recommended.
func GetPercentage ¶
GetPercentage returns the percentage of a part from a total.
Types ¶
Click to show internal directories.
Click to hide internal directories.