File: example_test.go

package info (click to toggle)
golang-gopkg-cheggaaa-pb.v1 1.0.25-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, buster-backports, experimental, sid
  • size: 160 kB
  • sloc: makefile: 2
file content (30 lines) | stat: -rw-r--r-- 441 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package pb_test

import (
	"time"

	"gopkg.in/cheggaaa/pb.v1"
)

func Example() {
	count := 5000
	bar := pb.New(count)

	// show percents (by default already true)
	bar.ShowPercent = true

	// show bar (by default already true)
	bar.ShowBar = true

	bar.ShowCounters = true

	bar.ShowTimeLeft = true

	// and start
	bar.Start()
	for i := 0; i < count; i++ {
		bar.Increment()
		time.Sleep(time.Millisecond)
	}
	bar.FinishPrint("The End!")
}