Skip to content

Latest commit

History

History
96 lines (66 loc) 路 2.31 KB

File metadata and controls

96 lines (66 loc) 路 2.31 KB

馃弰 Ravan

minimalist, progress bar library for Go.

the package name(Ravan) means smooth or flowing in persian. Exactly the same as the progress bar.

GitHub Release

Installation 馃殌

go get github.com/pooulad/ravan@latest

Usage 馃摑

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.

Bar characters 馃敜

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.

Custom message 馃挱

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

Documentation 馃搵

Go Reference

Check latest version please.

Demo 馃柤

ravan_sample_screenshot

License 馃搹

Distributed under the MIT License. See LICENSE for more information.

馃懁Author

Created with 鉂わ笍 by pooulad.