loading

module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT

README

⏳ loading

A collection of highly customisable loading bars for Go CLI apps.

Demo gif

Basic Usage

package main

import (
    "github.com/khulnasoft-lab/loading/pkg/bar"
    "time"
)

func main() {

    // create a bar
    loadingBar := bar.New()

    // set the total to 100
    loadingBar.SetTotal(100)

    // increment the bar to 100 over 10 seconds
    for i := 0; i <= 100; i++ {
        time.Sleep(time.Millisecond * 100)
        loadingBar.SetCurrent(i)
    }
}

See the examples or the gallery below for more inspiration.

Bar Anatomy

The anatomy of a bar

  1. The label, set with bar.OptionWithLabel("my label").
  2. The graphical component, set with bar.OptionWithRenderFunc(bar.RenderRainbow)
  3. The statistics component, set with bar.OptionWithStatsFuncs(bar.StatsTimeRemaining)

Gallery gif

Jump to

Keyboard shortcuts

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