Codebase list golang-github-vbauerster-mpb / 9dfdadf
Decorators package doc comments Vladimir Bauer 8 years ago
4 changed file(s) with 26 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
4747 bar := p.AddBar(int64(total),
4848 // Prepending decorators
4949 mpb.PrependDecorators(
50 // StaticName decorator with minWidth and no width sync options
50 // StaticName decorator with minWidth and no extra config
5151 // If you need to change name while rendering, use DynamicName
5252 decor.StaticName(name, len(name), 0),
53 // ETA decorator with minWidth and width sync options
54 // DSyncSpace is shortcut for DwidthSync|DextraSpace
55 decor.ETA(4, decor.DSyncSpace),
53 // ETA decorator with minWidth and no extra config
54 decor.ETA(4, 0),
5655 ),
5756 // Appending decorators
5857 mpb.AppendDecorators(
59 // Percentage decorator with minWidth and no width sync options
58 // Percentage decorator with minWidth and no extra config
6059 decor.Percentage(5, 0),
6160 ),
6261 )
6161 }
6262
6363 // DynamicName to be used, when there is a plan to change the name once or
64 // several times during progress rendering process
64 // several times during progress rendering process. If there're more than one
65 // bar, and you'd like to synchronize column width, conf param shauld have
66 // DwidthSync bit set.
6567 func DynamicName(nameFn func(*Statistics) string, minWidth int, conf byte) DecoratorFunc {
6668 format := "%%"
6769 if (conf & DidentRight) != 0 {
8587 // Counters provides basic counters decorator.
8688 // Accepts pairFormat string, something like "%s / %s" to be used in
8789 // fmt.Sprintf(pairFormat, current, total) and one of (Unit_KiB/Unit_kB)
88 // constant
90 // constant. If there're more than one bar, and you'd like to synchronize column
91 // width, conf param shauld have DwidthSync bit set.
8992 func Counters(pairFormat string, unit Units, minWidth int, conf byte) DecoratorFunc {
9093 format := "%%"
9194 if (conf & DidentRight) != 0 {
108111 }
109112 }
110113
114 // ETA provides exponential-weighted-moving-average ETA decorator.
115 // If there're more than one bar, and you'd like to synchronize column width,
116 // conf param shauld have DwidthSync bit set.
111117 func ETA(minWidth int, conf byte) DecoratorFunc {
112118 format := "%%"
113119 if (conf & DidentRight) != 0 {
128134 }
129135 }
130136
137 // Elapsed provides elapsed time decorator.
138 // If there're more than one bar, and you'd like to synchronize column width,
139 // conf param shauld have DwidthSync bit set.
131140 func Elapsed(minWidth int, conf byte) DecoratorFunc {
132141 format := "%%"
133142 if (conf & DidentRight) != 0 {
148157 }
149158 }
150159
160 // Percentage provides percentage decorator.
161 // If there're more than one bar, and you'd like to synchronize column width,
162 // conf param shauld have DwidthSync bit set.
151163 func Percentage(minWidth int, conf byte) DecoratorFunc {
152164 format := "%%"
153165 if (conf & DidentRight) != 0 {
2424 bar := p.AddBar(int64(total),
2525 // Prepending decorators
2626 mpb.PrependDecorators(
27 // StaticName decorator with minWidth and no width sync options
27 // StaticName decorator with minWidth and no extra config
2828 // If you need to change name while rendering, use DynamicName
2929 decor.StaticName(name, len(name), 0),
30 // ETA decorator with minWidth and width sync options
31 // DSyncSpace is shortcut for DwidthSync|DextraSpace
32 decor.ETA(4, decor.DSyncSpace),
30 // ETA decorator with minWidth and no extra config
31 decor.ETA(4, 0),
3332 ),
3433 // Appending decorators
3534 mpb.AppendDecorators(
36 // Percentage decorator with minWidth and no width sync options
35 // Percentage decorator with minWidth and no extra config
3736 decor.Percentage(5, 0),
3837 ),
3938 )
2424 bar := p.AddBar(int64(total),
2525 // Prepending decorators
2626 mpb.PrependDecorators(
27 // StaticName decorator with minWidth and no width sync options
27 // StaticName decorator with minWidth and no extra config
2828 // If you need to change name while rendering, use DynamicName
2929 decor.StaticName(name, len(name), 0),
30 // ETA decorator with minWidth and width sync options
31 // DSyncSpace is shortcut for DwidthSync|DextraSpace
32 decor.ETA(4, decor.DSyncSpace),
30 // ETA decorator with minWidth and no extra config
31 decor.ETA(4, 0),
3332 ),
3433 // Appending decorators
3534 mpb.AppendDecorators(
36 // Percentage decorator with minWidth and no width sync options
35 // Percentage decorator with minWidth and no extra config
3736 decor.Percentage(5, 0),
3837 ),
3938 )