ctrlcwrapper

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InnerIsReady

func InnerIsReady() tea.Msg

InnerIsReady is a tea.Cmd that the inner model can send to the wrapper model to indicate that it's ready to exit. This is helpful to the overall program because it allows the wrapper to exit earlier than it would if it waited for its own internal tick expiration event.

func New

func New[T tea.Model](inner T) tea.Model

New returns a new model that wraps the given model. The new model will exit when the user presses Ctrl+C.

Types

type AboutToExitMsg

type AboutToExitMsg struct{}

type Any

type Any interface {
	UserWantsToExit() bool
}

Any is a type that can be used to check if a model is a Model without knowing the inner type.

type Model

type Model[T tea.Model] struct {
	// contains filtered or unexported fields
}

func (Model[T]) Init

func (m Model[T]) Init() tea.Cmd

func (Model[T]) Unwrap

func (m Model[T]) Unwrap() T

Unwrap returns the inner model with its original type.

func (Model[T]) Update

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

func (Model[T]) UserWantsToExit

func (m Model[T]) UserWantsToExit() bool

UserWantsToExit returns true if the user pressed Ctrl+C. This can be used when the bubbletea program exits to determine if the user wants to exit the program.

func (Model[T]) View

func (m Model[T]) View() string

Jump to

Keyboard shortcuts

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