~poldi1405/go-indicators

9b373aa411a58e878c0dd9a3e43647a07a1890c7 — Moritz Poldrack 1 year, 9 months ago 68277c2 v1.0.0
expanded demo and added asciicast to readme
3 files changed, 9 insertions(+), 4 deletions(-)

M README.md
M main.go
M progress/doc_test.go
M README.md => README.md +2 -0
@@ 12,3 12,5 @@ You can run an example of what it can look like by executing
go get gitlab.com/poldi1405/go-indicators
go run gitlab.com/poldi1405/go-indicators
```

[![asciicast](https://asciinema.org/a/xx4sgRKJLhLKRJ7kPLBD9NQCe.svg)](https://asciinema.org/a/xx4sgRKJLhLKRJ7kPLBD9NQCe)

M main.go => main.go +5 -2
@@ 19,8 19,10 @@ func main() {
	preparationspinner()
	fmt.Println(strings.Repeat("=", 20))
	var p progress.Progress
	fmt.Println(p.GetBar(275, 346))
	fmt.Println(strings.Repeat("=", 20))
	p.Width = 30
	p.SetStyle("trapez")
	p.SetStyle("parallelogram")

	for i := 0; i < 350; i++ {
		perc, _ := progress.GetPercentage(float64(i), 350)


@@ 31,6 33,7 @@ func main() {
	fmt.Println(strings.Repeat("=", 20))
	var s spinner.Spinner
	s.SetStyle("bouncing-bar")
	p.SetStyle("spaced-blocks")
	for i := 0; i < 450; i++ {
		if i < 100 {
			fmt.Printf("\r%v", s.Next())


@@ 51,7 54,7 @@ func main() {
		fmt.Printf("\r%v %v %3.f%%", s.Next(), p.GetBar(float64(i-100), 350), perc)
		time.Sleep(50 * time.Millisecond)
	}
	fmt.Println()
	fmt.Println("\r", s.Clear())
}

func basicexample() {

M progress/doc_test.go => progress/doc_test.go +2 -2
@@ 6,14 6,14 @@ func Example() {
	p.GetBar(275, 346)
}

// The easiest way to get a progressbar is as follows
// Changing the Style is not hard, in fact it's quite easy
func Example_styled() {
	var p Progress
	p.SetStyle("parallelogram")
	p.GetBar(275, 346)
}

// The easiest way to get a progressbar is as follows
// Using a custom style is as simple as adding it and changing to it
func Example_customStyle() {
	var p Progress