Skip to content
/ bw Public

Terminal progress table like Bubble Wrap for Golang

License

Notifications You must be signed in to change notification settings

kura-lab/bw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terminal progress table like Bubble Wrap for Golang

Build Status GoDoc

Demo

bw

Installation

go get github.com/kura-lab/bw

Get start

package main

import (
	"time"

	"github.com/kura-lab/bw"
)

func main() {
	numbers := 220

	bw := bw.NewBubbleWrap(numbers)
	bw.Display()

	for i := 0; i < numbers; i++ {
		time.Sleep(20 * time.Millisecond)
		bw.Pop(i)
		bw.Redisplay()

		// you can call when need to interrupt
		// bw.Interrupt()
	}
}

Settings

numbers := 220

// set numbers of a column
bw := NewBubbleWrap(numbers).SetColumn(60)

// change bubble's shapes
bw := NewBubbleWrap(numbers).ChangeBubbleShape("o", "x")

// change bubble's colors
before := color.New(color.FgCyan)
after := color.New(color.FgRed)
bw := NewBubbleWrap(numbers).ChangeBubbleColor(before, after)