Codebase list golang-github-vbauerster-mpb / 71c6008
DefaultBarStyle -> BarDefaultStyle Vladimir Bauer 5 years ago
2 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
1919 rRefill
2020 )
2121
22 // DefaultBarStyle is a string containing 7 runes.
23 // Each rune is a building block of a progress bar.
22 // BarDefaultStyle is a style for rendering a progress bar.
23 // It consist of 7 ordered runes:
2424 //
2525 // '1st rune' stands for left boundary rune
2626 //
3636 //
3737 // '7th rune' stands for refill rune
3838 //
39 const DefaultBarStyle string = "[=>-]<+"
39 const BarDefaultStyle string = "[=>-]<+"
4040
4141 type barFiller struct {
4242 format [][]byte
6262 // NewBarFillerRev same as NewBarFiller but with explicit reverse option.
6363 func NewBarFillerRev(style string, rev func() bool) BarFiller {
6464 bf := &barFiller{
65 format: make([][]byte, len(DefaultBarStyle)),
66 rwidth: make([]int, len(DefaultBarStyle)),
6765 reverse: rev(),
66 format: make([][]byte, len(BarDefaultStyle)),
67 rwidth: make([]int, len(BarDefaultStyle)),
6868 }
69 bf.parse(DefaultBarStyle)
70 if style != "" && style != DefaultBarStyle {
69 bf.parse(BarDefaultStyle)
70 if style != "" && style != BarDefaultStyle {
7171 bf.parse(style)
7272 }
7373 return bf
9696
9797 // AddBar creates a new progress bar and adds it to the rendering queue.
9898 func (p *Progress) AddBar(total int64, options ...BarOption) *Bar {
99 return p.Add(total, NewBarFiller(DefaultBarStyle), options...)
99 return p.Add(total, NewBarFiller(BarDefaultStyle), options...)
100100 }
101101
102102 // AddSpinner creates a new spinner bar and adds it to the rendering queue.