progressbar

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

README

Progress Bar

pipeline status

coverage report

Go Report Card

Go Reference

Simple and quick package to display progress bars in terminal.

Now with durations but more to come.

Install

go get gitlab.com/franckf/progressbar

Example

package main

import (
	"fmt"
	"time"

	"gitlab.com/franckf/progressbar"
)

func main() {
	start := time.Now()
	tensec := time.Second * 10
	progressbar.WithDuration("stand-by text", tensec)
	elapsed := time.Since(start)
	fmt.Println(elapsed)

	alphabet := []string{"a", "b", "c", "d", "e"}
	fmt.Println("alphabet")
	for i := range alphabet {
		// dealing with every step
		time.Sleep(time.Second)
		progressbar.WithSteps(i, len(alphabet))
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDuration added in v1.1.0

func WithDuration(fullText string, duration time.Duration)

func WithSteps added in v1.1.0

func WithSteps(step int, total int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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