minimalist, dependency-free progress bar library for Go.
the package name(Ravan) means smooth or flowing in persian. Exactly the same as the progress bar.
go get github.com/pooulad/ravan@latest
package main
import (
"errors"
"fmt"
"time"
"github.com/pooulad/ravan"
)
func main() {
files := []string{"file1.txt", "file2.txt", "file3.txt", "file4.txt", "file6.txt"}
bar, _ := ravan.New(ravan.WithMessage(&ravan.Message{Failed: "error custom message", Success: "success custom message"}))
for i, file := range files {
err := processFile(file)
if err != nil {
bar.FailMsg(fmt.Errorf("error processing %s: %w", file, err))
return
}
bar.Draw(float64(i+1) / float64(len(files)))
}
bar.SuccessMsg()
}
See examples directory that added examples of all versions.also you can read the documentation that is in next section.
Name | Sign |
---|---|
Hash | "#" |
Asterisk | "*" |
Equal | "=" |
Plus | "+" |
Dash | "-" |
GreaterThan | ">" |
LessThan | "<" |
Colon | ":" |
Exclamation | "!" |
DollarSign | "$" |
AtSign | "@" |
Percent | "%" |
CircumFlex | "^" |
And | "&" |
Empty | " " |
📌Empty only available in WithIncompleteChar func.it is obvious that completed bar section can't fill with Empty char.
in v0.0.3 and above you can set custom Message struct for handling in error and successful situation with WithMessage func.
bar, _ := ravan.New(ravan.WithMessage(&ravan.Message{Failed: "error custom message", Success: "success custom message"}))
See and run this example
Check latest version please.
Distributed under the MIT License. See LICENSE for more information.
Created with ❤️ by pooulad.