progress

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProgressBar

func NewProgressBar(action string, color Color) chan<- struct{}

NewProgressBar creates a new progress bar with the specified action and color. It takes the action string and color as input and returns a channel for controlling the progress bar. The progress bar is updated at regular intervals and can be stopped by closing the returned channel. The color parameter specifies the color of the progress bar. Example usage:

progressChan := NewProgressBar("Downloading", ColorBlue)
// Perform download operation
close(progressChan) // Stop the progress bar

Note: It is important to close the returned channel to stop the progress bar and free resources.

Types

type Color

type Color string
const (
	ColorReset Color = "[reset]"
	ColorWhite Color = "[white]"
	ColorBlue  Color = "[blue]"
	ColorRed   Color = "[red]"
	ColorGreen Color = "[green]"
)

Jump to

Keyboard shortcuts

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