progress

package module
v0.0.0-...-e06cc96 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 6 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-progress

A Go library to display progression in console tool. Provides unicode themes with a really simple API.

example gif

Usage

To use, create a new bar with the total, and call the Set() func to update the value, and you are done.

bar := progress.New(100)

//Choose your style!
bar.Format = progress.ProgressFormats[4]

for bar.Inc() {
	time.Sleep(time.Millisecond * 20)
}

License

go-progress is released under the MIT License. See LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProgressFormats = []Format{

		{
			Fill:  []string{"▓", "█"},
			Empty: "░",
		},

		{
			Fill:  []string{"⬤"},
			Empty: "◯",
		},

		{
			Fill:  []string{"■"},
			Empty: "□",
		},

		{
			Fill:  []string{"⚫"},
			Empty: "⚪",
		},

		{
			Fill:  []string{"▰"},
			Empty: "▱",
		},

		{
			Fill:  []string{"⬛"},
			Empty: "⬜",
		},

		{
			Fill:  []string{"⡀", "⡄", "⡆", "⡇", "⡏", "⡟", "⡿", "⣿"},
			Empty: "⣀",
		},

		{
			Fill:     []string{"="},
			Head:     ">",
			LeftEnd:  "[",
			RightEnd: "]",
			Empty:    " ",
		},

		{
			Fill:  []string{"▏", "▎", "▍", "▌", "▋", "▊", "▉"},
			Empty: " ",
		},
	}
)

Functions

This section is empty.

Types

type Format

type Format struct {
	Fill     []string
	Head     string
	Empty    string
	LeftEnd  string
	RightEnd string
}

type ProgressBar

type ProgressBar struct {
	Format

	Out   io.Writer //where to write
	Width int       //width of the bar

	ShowPercent    bool //show percent
	ShowNumeric    bool //show current/total
	ShowTextSuffix bool //show suffix text
	// contains filtered or unexported fields
}

func New

func New(total int) *ProgressBar

func (*ProgressBar) Inc

func (p *ProgressBar) Inc() bool

func (*ProgressBar) Set

func (p *ProgressBar) Set(to int) bool

func (*ProgressBar) SetTextSuffix

func (p *ProgressBar) SetTextSuffix(suffix string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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