File: example_test.go

package info (click to toggle)
golang-github-gosuri-uilive 0.0~git20170323.ac356e6-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 244 kB
  • sloc: makefile: 4
file content (23 lines) | stat: -rw-r--r-- 403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package uilive_test

import (
	"fmt"
	"time"

	"github.com/gosuri/uilive"
)

func Example() {
	writer := uilive.New()

	// start listening to updates and render
	writer.Start()

	for i := 0; i <= 100; i++ {
		fmt.Fprintf(writer, "Downloading.. (%d/%d) GB\n", i, 100)
		time.Sleep(time.Millisecond * 5)
	}

	fmt.Fprintln(writer, "Finished: Downloaded 100GB")
	writer.Stop() // flush and stop rendering
}