progress

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithProgress

func WithProgress(message string, fn func() error) error

WithProgress runs a function with a progress indicator

func WithProgressSteps

func WithProgressSteps(message string, fn func(update func(string), progress func(int, int)) error) error

WithProgressSteps runs a function with progress tracking

Types

type DoneMsg

type DoneMsg struct {
	Error error
}

DoneMsg signals completion

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model represents the progress indicator model

func New

func New(message string) Model

New creates a new progress indicator

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init implements tea.Model

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model

func (*Model) View

func (m *Model) View() string

View implements tea.Model

type Msg

type Msg struct {
	Current int
	Total   int
}

Msg updates the progress percentage

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner provides a simple interface to run operations with progress

func NewRunner

func NewRunner(message string) *Runner

NewRunner creates a new progress runner

func (*Runner) Done

func (r *Runner) Done(err error)

Done signals completion

func (*Runner) SetProgress

func (r *Runner) SetProgress(current, total int)

SetProgress updates the progress counter

func (*Runner) Start

func (r *Runner) Start()

Start starts the progress indicator

func (*Runner) Success

func (r *Runner) Success()

Success signals successful completion

func (*Runner) Update

func (r *Runner) Update(message string)

Update updates the progress message

type UpdateMsg

type UpdateMsg struct {
	Message string
}

UpdateMsg updates the progress message

Jump to

Keyboard shortcuts

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