bw

package module
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 4 Imported by: 0

README

Terminal progress table like Bubble Wrap for Golang

Build Status

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)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BubbleWrap

type BubbleWrap struct {
	// contains filtered or unexported fields
}

func NewBubbleWrap

func NewBubbleWrap(numbers int) *BubbleWrap

func (*BubbleWrap) ChangeBubbleColor added in v1.0.5

func (bw *BubbleWrap) ChangeBubbleColor(before *color.Color, after *color.Color) *BubbleWrap

func (*BubbleWrap) ChangeBubbleShape added in v1.0.4

func (bw *BubbleWrap) ChangeBubbleShape(before string, after string) *BubbleWrap

func (*BubbleWrap) Clear

func (bw *BubbleWrap) Clear()

func (*BubbleWrap) Display

func (bw *BubbleWrap) Display()

func (*BubbleWrap) Interrupt added in v1.0.7

func (bw *BubbleWrap) Interrupt()

func (*BubbleWrap) Pop

func (bw *BubbleWrap) Pop(i int)

func (*BubbleWrap) Redisplay

func (bw *BubbleWrap) Redisplay()

func (*BubbleWrap) SetColumn

func (bw *BubbleWrap) SetColumn(column int) *BubbleWrap

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL