progressbar

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: MIT Imports: 7 Imported by: 1

README ΒΆ

Go Go Reference Go Report Card coverage

progressbar

A simple progress bar for golang projects. I created that because there was a long processes in some project and I didn't know what was the progression.

Installation

go get -u github.com/disco07/progressbar

Usage

Basic usage
bar := progressbar.Default(100)
for i := 0; i < 100; i++ {
    bar.Add(1)
    time.Sleep(100 * time.Millisecond)
}

Basic bar

Contributing 🀝

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

πŸ“ License

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

This section is empty.

Types ΒΆ

type Bar ΒΆ

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

func Default ΒΆ

func Default(end int64) *Bar

Default is a basic usage of progress bar. In parameter, the max size of things you want to view progress. It returns a pointer of Bar.

func DefaultBytes ΒΆ added in v0.2.1

func DefaultBytes(end int64) *Bar

func New ΒΆ

func New(end int64) *Bar

func (*Bar) Add ΒΆ

func (b *Bar) Add(num int) error

Add is a func who add the number passed as a parameter to the progress bar.

func (*Bar) Read ΒΆ added in v0.2.1

func (b *Bar) Read(byte []byte) (n int, err error)

Read implement io.Reader

func (*Bar) SetTheme ΒΆ

func (b *Bar) SetTheme(t Theme)

func (*Bar) Write ΒΆ added in v0.2.1

func (b *Bar) Write(byte []byte) (n int, err error)

Write implement io.Writer

type Reader ΒΆ added in v0.2.1

type Reader struct {
	io.Reader
	// contains filtered or unexported fields
}

Reader is the progressbar io.Reader.

func NewReader ΒΆ added in v0.2.1

func NewReader(r io.Reader, bar *Bar) Reader

NewReader return a new Reader with a given progress bar.

func (*Reader) Read ΒΆ added in v0.2.1

func (r *Reader) Read(byte []byte) (int, error)

Read will read the data and add the number of bytes to the progressbar

type Theme ΒΆ

type Theme struct {
	GraphType  string
	GraphStart string
	GraphEnd   string
	GraphWidth int64
	// contains filtered or unexported fields
}

Directories ΒΆ

Path Synopsis
examples
basic command
custom command
download command

Jump to

Keyboard shortcuts

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