common

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitForStatusMessageTimeout

func WaitForStatusMessageTimeout(appCtx ApplicationContext, t *time.Timer) tea.Cmd

Types

type ApplicationContext

type ApplicationContext int

ApplicationContext indicates the area of the application something applies to. Occasionally used as an argument to commands and messages.

const (
	ListContext ApplicationContext = iota
	PagerContext

	StatusMessageTimeout = time.Second * 3 // How long to show status messages.
)

type Commander

type Commander interface {
	Run() command.Output
	RunOnEvent()
	String() string
	Subscribe(ch chan<- command.Event)
	GetCurrentProfile() *profile.Profile
	RunPlugin(name string) command.Output
}

type CommonModel

type CommonModel struct {
	Cmd                Commander
	Theme              *theme.Theme
	StatusMessageTimer *time.Timer
	KeyBinds           *KeyBinds
	StatusMessage      StatusMessage
	Width              int
	Height             int
	Loaded             bool
	ShowStatusMessage  bool // Whether to show the status message in the status bar.
}

func (*CommonModel) GetStatusBar

func (m *CommonModel) GetStatusBar() *statusbar.StatusBarRenderer

func (*CommonModel) SendStatusMessage

func (m *CommonModel) SendStatusMessage(msg string, style statusbar.Style) tea.Cmd

Show a status (success) message to the user.

type ErrMsg

type ErrMsg struct{ Err error } //nolint:errname // Tea message.

func (ErrMsg) Error

func (e ErrMsg) Error() string

type KeyBinds

type KeyBinds struct {
	Quit    *keys.KeyBind `json:"quit,omitempty"`
	Suspend *keys.KeyBind `json:"suspend,omitempty"`
	Reload  *keys.KeyBind `json:"reload,omitempty"`
	Help    *keys.KeyBind `json:"help,omitempty"`
	Error   *keys.KeyBind `json:"error,omitempty"`
	Escape  *keys.KeyBind `json:"escape,omitempty"`

	// Navigation.
	Up    *keys.KeyBind `json:"up,omitempty"`
	Down  *keys.KeyBind `json:"down,omitempty"`
	Left  *keys.KeyBind `json:"left,omitempty"`
	Right *keys.KeyBind `json:"right,omitempty"`
	Prev  *keys.KeyBind `json:"prev,omitempty"`
	Next  *keys.KeyBind `json:"next,omitempty"`
}

func (*KeyBinds) EnsureDefaults

func (kb *KeyBinds) EnsureDefaults()

func (*KeyBinds) GetKeyBinds

func (kb *KeyBinds) GetKeyBinds() []keys.KeyBind

type StatusMessage

type StatusMessage struct {
	Message string
	Style   statusbar.Style
}

type StatusMessageTimeoutMsg

type StatusMessageTimeoutMsg ApplicationContext

Jump to

Keyboard shortcuts

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