example/simple/simple.go
raw| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "time" |
| 5 | |
| 6 | "github.com/gosuri/uiprogress" |
| 7 | ) |
| 8 | |
| 9 | func main() { |
| 10 | uiprogress.Start() // start rendering |
| 11 | bar := uiprogress.AddBar(100) // Add a new bar |
| 12 | |
| 13 | // optionally, append and prepend completion and elapsed time |
| 14 | bar.AppendCompleted() |
| 15 | bar.PrependElapsed() |
| 16 | |
| 17 | for bar.Incr() { |
| 18 | time.Sleep(time.Millisecond * 20) |
| 19 | } |
| 20 | } |