progress

package
v0.0.0-...-40cbffd Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package progress provides shared helpers around bubbles progress bars and programs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClampPercent

func ClampPercent(percent float64) float64

ClampPercent limits the percent value to the valid range [0, 1].

func GetResponsiveBarWidth

func GetResponsiveBarWidth() int

GetResponsiveBarWidth calculates the optimal progress bar width based on terminal size. It uses widthRatio of terminal width, clamped between minWidth and maxWidth.

func GetTerminalWidth

func GetTerminalWidth() int

GetTerminalWidth returns the current terminal width, or defaultWidth if detection fails.

func NewBar

func NewBar(width int) progress.Model

NewBar returns a progress.Model with a consistent style and width. If width <= 0, it automatically calculates an appropriate width based on terminal size. In NO_COLOR mode, uses default monochrome style without gradient.

func StartProgram

func StartProgram(model tea.Model, out io.Writer) (*tea.Program, chan struct{})

StartProgram starts a bubbletea program unless progress output is suppressed. It returns the program (nil when suppressed) and a done channel that closes after Run completes.

func UpdateBar

func UpdateBar(bar progress.Model, msg tea.Msg) (progress.Model, tea.Cmd)

UpdateBar safely updates a bubbles progress bar and preserves the typed model.

Types

This section is empty.

Jump to

Keyboard shortcuts

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