common

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 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              *themes.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 `yaml:"quit"`
	Suspend *keys.KeyBind `yaml:"suspend"`
	Reload  *keys.KeyBind `yaml:"reload"`
	Help    *keys.KeyBind `yaml:"help"`
	Error   *keys.KeyBind `yaml:"error"`
	Escape  *keys.KeyBind `yaml:"escape"`

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

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