progressbar

package
v0.0.0-...-cb7a572 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	Width       int
	Stages      []ProgressFunc
	InitMessage string
	// contains filtered or unexported fields
}

Model is a data container used to store TUI status information.

func (*Model) Canceled

func (m *Model) Canceled() bool

Canceled determine whether the operation is cancelled

func (*Model) Error

func (m *Model) Error() error

Error returns the error generated during the execution of ProgressFunc

func (*Model) Index

func (m *Model) Index() int

Index returns the index of the ProgressFunc currently executed

func (Model) Init

func (m Model) Init() tea.Cmd

Init performs some io initialization actions, The current Init returns the first ProgressFunc to trigger the program to run.

func (*Model) Update

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

Update method responds to various events and modifies the data model according to the corresponding events

func (Model) View

func (m Model) View() string

View reads the data state of the data model for rendering

type ProgressFunc

type ProgressFunc func() (string, error)

ProgressFunc is a simple function, the progress bar will step a certain distance after each execution

Jump to

Keyboard shortcuts

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