progress

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressStyle

type ProgressStyle string

ProgressStyle represents different progress bar styles

const (
	StyleBasic   ProgressStyle = "basic"   // [=====>     ]
	StyleBlocks  ProgressStyle = "blocks"  // █████░░░░░
	StyleModern  ProgressStyle = "modern"  // ○○●●●○○○
	StyleEmoji   ProgressStyle = "emoji"   // 🟦🟦🟦⬜⬜
	StyleMinimal ProgressStyle = "minimal" // 43% | 4.2MB/s
)

func ValidStyles

func ValidStyles() []ProgressStyle

ValidStyles returns a list of valid progress bar styles

type ProgressTracker

type ProgressTracker struct {
	TotalSize     int64
	UploadedSize  int64
	StartTime     time.Time
	LastUpdate    time.Time
	Style         ProgressStyle
	CustomEmoji   string
	Width         int
	LastChunkSize int64
	LastSpeed     float64
}

ProgressTracker keeps track of upload progress

func NewProgressTracker

func NewProgressTracker(totalSize int64, style ProgressStyle) *ProgressTracker

NewProgressTracker creates a new progress tracker

func (*ProgressTracker) Finish

func (p *ProgressTracker) Finish()

Finish prints final progress and moves to next line

func (*ProgressTracker) UpdateProgress

func (p *ProgressTracker) UpdateProgress(uploadedSize int64)

UpdateProgress updates the progress and displays the progress bar

Jump to

Keyboard shortcuts

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