Documentation
¶
Index ¶
- Constants
- Variables
- func NewHelpModel() help.Model
- type EmptyScreenComponent
- type HelpComponent
- type KeyMap
- type LiteralBindingName
- type StatusComponent
- func (s *StatusComponent) Render(followMode bool) string
- func (s *StatusComponent) SetAlwaysOnDisplayMessage(alwaysOnDisplayMessage string) *StatusComponent
- func (s *StatusComponent) SetShortHelpMessage(shortHelpMessage string) *StatusComponent
- func (s *StatusComponent) SetStyle(style lipgloss.Style) *StatusComponent
- func (s *StatusComponent) UpdateStatus(status string) *StatusComponent
- func (s *StatusComponent) UpdateStatusMessage(message string) *StatusComponent
Constants ¶
const ( StatusSuccess = "success" StatusError = "error" StatusWarning = "warning" StatusInfo = "info" StatusLoading = "loading" )
Status types
Variables ¶
var Keys = KeyMap{ GoBack: key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "go back"), ), Up: key.NewBinding( key.WithKeys("up"), key.WithHelp("↑", "move up"), ), Down: key.NewBinding( key.WithKeys("down"), key.WithHelp("↓", "move down"), ), Left: key.NewBinding( key.WithKeys("left"), key.WithHelp("←", "move left"), ), Right: key.NewBinding( key.WithKeys("right"), key.WithHelp("→", "move right"), ), Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "toggle help"), ), Quit: key.NewBinding( key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit"), ), Refresh: key.NewBinding( key.WithKeys("r"), key.WithHelp("r", "refresh data"), ), Logs: key.NewBinding( key.WithKeys("l"), key.WithHelp("l", "toggle logs view"), ), Tab: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "switch focus"), ), NextPage: key.NewBinding( key.WithKeys("n"), key.WithHelp("n", "next page"), ), PrevPage: key.NewBinding( key.WithKeys("p"), key.WithHelp("p", "previous page"), ), FollowMode: key.NewBinding( key.WithKeys("f"), key.WithHelp("f", "toggle follow mode"), ), }
Functions ¶
func NewHelpModel ¶
NewHelpModel creates a new help model with the default keyMap
Types ¶
type EmptyScreenComponent ¶
type EmptyScreenComponent struct {
Icon string
Title string
Description string
Action string
Style lipgloss.Style
// contains filtered or unexported fields
}
EmptyScreenComponent represents a reusable empty state component
func NewEmptyScreenComponent ¶
func NewEmptyScreenComponent(title, description string, width, height int) *EmptyScreenComponent
NewEmptyScreenComponent creates a new empty screen component
func NewNoDataEmptyScreen ¶
func NewNoDataEmptyScreen(width, height int) *EmptyScreenComponent
Common empty screen types
func NewNoLogsEmptyScreen ¶
func NewNoLogsEmptyScreen(width, height int) *EmptyScreenComponent
func (*EmptyScreenComponent) Render ¶
func (e *EmptyScreenComponent) Render() string
Render returns the formatted empty screen string
func (*EmptyScreenComponent) SetAction ¶
func (e *EmptyScreenComponent) SetAction(action string) *EmptyScreenComponent
SetAction sets the action text for the empty screen
func (*EmptyScreenComponent) SetIcon ¶
func (e *EmptyScreenComponent) SetIcon(icon string) *EmptyScreenComponent
SetIcon sets the icon for the empty screen
func (*EmptyScreenComponent) SetStyle ¶
func (e *EmptyScreenComponent) SetStyle(style lipgloss.Style) *EmptyScreenComponent
SetStyle allows customizing the empty screen style
type HelpComponent ¶
type HelpComponent struct {
Title string
Description string
Style lipgloss.Style
// contains filtered or unexported fields
}
HelpComponent represents a reusable help component using bubbles help
func NewHelpComponent ¶
func NewHelpComponent(title, description string) *HelpComponent
NewHelpComponent creates a new help component
func (*HelpComponent) GetHelpModel ¶
func (h *HelpComponent) GetHelpModel() help.Model
GetHelpModel returns the underlying help model for direct manipulation
func (*HelpComponent) IsShowingAll ¶
func (h *HelpComponent) IsShowingAll() bool
IsShowingAll returns whether the full help is being shown
func (*HelpComponent) Render ¶
func (h *HelpComponent) Render() string
Render returns the formatted help string
func (*HelpComponent) SetWidth ¶
func (h *HelpComponent) SetWidth(width int)
SetWidth sets the width of the help component
func (*HelpComponent) ShowAll ¶
func (h *HelpComponent) ShowAll(show bool)
ShowAll toggles the help view between short and full
func (*HelpComponent) ToggleHelp ¶
func (h *HelpComponent) ToggleHelp()
ToggleHelp toggles the help view
type KeyMap ¶
type KeyMap struct {
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
Help key.Binding
Quit key.Binding
Refresh key.Binding
Logs key.Binding
Tab key.Binding
GoBack key.Binding
NextPage key.Binding
PrevPage key.Binding
FollowMode key.Binding
// contains filtered or unexported fields
}
KeyMap defines a set of keybindings. To work for help it must satisfy key.Map. It could also very easily be a map[string]key.Binding.
func (KeyMap) FullHelp ¶
FullHelp returns keybindings for the expanded help view. It's part of the key.Map interface.
func (*KeyMap) GetBasicShortHelpNames ¶
func (k *KeyMap) GetBasicShortHelpNames() []LiteralBindingName
func (*KeyMap) SetShortHelpByNames ¶
func (k *KeyMap) SetShortHelpByNames(fieldNames ...LiteralBindingName)
SetShortHelp sets the short help using field names from the KeyMap
type LiteralBindingName ¶
type LiteralBindingName string
const ( LiteralBindingNameUp LiteralBindingName = "up" LiteralBindingNameDown LiteralBindingName = "down" LiteralBindingNameLeft LiteralBindingName = "left" LiteralBindingNameRight LiteralBindingName = "right" LiteralBindingNameHelp LiteralBindingName = "help" LiteralBindingNameQuit LiteralBindingName = "quit" LiteralBindingNameRefresh LiteralBindingName = "refresh" LiteralBindingNameLogs LiteralBindingName = "logs" LiteralBindingNameTab LiteralBindingName = "tab" LiteralBindingNameGoBack LiteralBindingName = "go_back" LiteralBindingNameNextPage LiteralBindingName = "next_page" LiteralBindingNamePrevPage LiteralBindingName = "prev_page" LiteralBindingNameFollowMode LiteralBindingName = "follow_mode" )
type StatusComponent ¶
type StatusComponent struct {
Status string
Message string
Timestamp time.Time
Style lipgloss.Style
// contains filtered or unexported fields
}
StatusComponent represents a reusable status component
func NewStatusComponent ¶
func NewStatusComponent(status, message string) *StatusComponent
NewStatusComponent creates a new status component
func (*StatusComponent) Render ¶
func (s *StatusComponent) Render(followMode bool) string
Render returns the formatted status string
func (*StatusComponent) SetAlwaysOnDisplayMessage ¶
func (s *StatusComponent) SetAlwaysOnDisplayMessage(alwaysOnDisplayMessage string) *StatusComponent
func (*StatusComponent) SetShortHelpMessage ¶
func (s *StatusComponent) SetShortHelpMessage(shortHelpMessage string) *StatusComponent
func (*StatusComponent) SetStyle ¶
func (s *StatusComponent) SetStyle(style lipgloss.Style) *StatusComponent
SetStyle allows customizing the status style
func (*StatusComponent) UpdateStatus ¶
func (s *StatusComponent) UpdateStatus(status string) *StatusComponent
func (*StatusComponent) UpdateStatusMessage ¶
func (s *StatusComponent) UpdateStatusMessage(message string) *StatusComponent