~poldi1405/go-indicators

ef3187efb4a1ff09c4d51f723313d17d0bb4d103 — Moritz Poldrack 1 year, 9 months ago 093b67e
not the most elegant solution but it works
2 files changed, 4 insertions(+), 1 deletions(-)

M main.go
M progress/type.go
M main.go => main.go +1 -1
@@ 46,7 46,7 @@ func main() {
	p.Width = 20
	p.Style = "block"
	s.SetStyle("braille")
	for i := 0; i < 350; i++ {
	for i := 0; i < 450; i++ {
		perc, _ := progress.GetPercentage(float64(i-100), 350)
		fmt.Printf("\r%v %v %3.f%%", s.Next(), p.GetBar(float64(i-100), 350), perc)
		time.Sleep(50 * time.Millisecond)

M progress/type.go => progress/type.go +3 -0
@@ 54,6 54,9 @@ func (p *Progress) GetBar(parts, total float64) (result string) {
	charindex = int(temp)

	if charindex > 0 {
		if charindex > maxIndex {
			charindex = maxIndex
		}
		result += ProgressStyles[p.Style][charindex]
		counter++
	}