taskprogress

package
v0.0.0-...-6586b8c Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 12 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	// ui components (view models)
	Spinner     spinner.Model
	ProgressBar progressBubble.Model

	// enums for view model
	TitleOptions Title
	Hints        []string
	Context      []string

	WindowSize tea.WindowSizeMsg

	UpdateDuration        time.Duration
	HideProgressOnSuccess bool
	HideStageOnSuccess    bool
	HideOnSuccess         bool

	TitleStyle lipgloss.Style
	// TitlePendingStyle lipgloss.Style
	HintStyle    lipgloss.Style
	ContextStyle lipgloss.Style
	SuccessStyle lipgloss.Style
	FailedStyle  lipgloss.Style
	TitleWidth   int
	HintEndCaps  []string
	// contains filtered or unexported fields
}

func New

func New(wg *sync.WaitGroup, opts ...Option) Model

New returns a model with default values.

func (Model) ID

func (m Model) ID() int

ID returns the spinner's unique ID.

func (Model) Init

func (m Model) Init() tea.Cmd

Init is the command that effectively starts the continuous update loop.

func (Model) IsVisible

func (m Model) IsVisible() bool

func (Model) Sequence

func (m Model) Sequence() int

Sequence returns the spinner's current sequence number.

func (Model) Update

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

Update is the Tea update function.

func (Model) View

func (m Model) View() string

View renders the model's view.

type Option

type Option func(*Model)

func WithNoStyle

func WithNoStyle() Option

func WithProgress

func WithProgress(prog progress.Progressable) Option

func WithStagedProgressable

func WithStagedProgressable(s progress.StagedProgressable) Option

func WithStager

func WithStager(s progress.Stager) Option

type TickMsg

type TickMsg struct {
	Time     time.Time
	Sequence int
	ID       int
}

TickMsg indicates that the timer has ticked and we should render a frame.

type Title

type Title struct {
	Default string
	Running string
	Success string
	Failed  string
}

func (Title) Title

func (t Title) Title(p progress.Progress) string

Jump to

Keyboard shortcuts

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