Documentation
¶
Index ¶
- func Back() tea.Msg
- func BackN(steps int) tea.Cmd
- func Error(err error) tea.Cmd
- func Notify(message string, duration time.Duration) tea.Cmd
- func PushState(state State, save bool) tea.Cmd
- func ReplaceState(state State) tea.Cmd
- func SendCmd(cmdSupplier func() (tea.Cmd, error)) tea.Cmd
- func StartSpinner() tea.Msg
- func StopSpinner() tea.Msg
- type KeyMap
- type Model
- type ModelHandler
- type OnErrorFunc
- type Option
- type Size
- type State
- type StyleMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceState ¶
Types ¶
type KeyMap ¶
type KeyMap struct {
Quit key.Binding
Back key.Binding
Help key.Binding
// contains filtered or unexported fields
}
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func (*Model) SpinnerActive ¶
type ModelHandler ¶
type OnErrorFunc ¶
type Option ¶
type Option func(model *Model)
func WithAutoSize ¶
func WithAutoSize() Option
WithAutoSize gets terminal dimensions and sets Model's size. It will also make the Model listen for incoming resize messages from temrinal.
func WithKeyMap ¶
func WithOnError ¶
func WithOnError(onError OnErrorFunc) Option
func WithSaveInitialStateToHistory ¶ added in v0.2.0
func WithSpinner ¶
WithSpinner sets a custom spinner.Spinner for Model
func WithStyleMap ¶
type State ¶
type State interface {
// Destroy is called before the state is popped out from history
Destroy()
// Backable whether the state can be popped from history
Backable() bool
// Resize the state
Resize(size Size) tea.Cmd
// Title of the state
Title() title.Title
// Subtitle is displayed under the title.
// If empty string is given subtitle won't be rendered
Subtitle() string
// Status is displayed next to the title
Status() string
// KeyMap of the state
KeyMap() help.KeyMap
// Init is the first function that will be called. It returns an optional
// initial command. To not perform an initial command return nil.
Init(mh ModelHandler) tea.Cmd
// Update is called when a message is received. Use it to inspect messages
// and, in response, update the model and/or send a command.
Update(mh ModelHandler, msg tea.Msg) tea.Cmd
// View renders the state's UI, which is just a string. The view is
// rendered after every Update.
View(mh ModelHandler) string
}
State that model operates
Click to show internal directories.
Click to hide internal directories.