Documentation
¶
Overview ¶
Package command provides a command palette component for the memtui application.
Package command provides a command palette component for the memtui application. It implements a VS Code-style command palette with fuzzy search functionality.
Index ¶
- func FuzzyMatch(query, text string) (bool, int)
- type Command
- type CommandCancelMsg
- type CommandExecuteMsg
- type CommandPalette
- func (p *CommandPalette) Hide()
- func (p *CommandPalette) Init() tea.Cmd
- func (p *CommandPalette) SelectedCommand() *Command
- func (p *CommandPalette) SetSize(width, height int)
- func (p *CommandPalette) Show()
- func (p *CommandPalette) Toggle()
- func (p *CommandPalette) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (p *CommandPalette) View() string
- func (p *CommandPalette) Visible() bool
- type CopyValueMsg
- type DeleteKeyMsg
- type EditValueMsg
- type FilterKeysMsg
- type NewKeyMsg
- type QuitMsg
- type RefreshKeysMsg
- type ShowHelpMsg
- type ShowStatsMsg
- type ToggleThemeMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FuzzyMatch ¶
FuzzyMatch performs a fuzzy match of query against text. It returns whether there is a match and a score (higher is better). The matching is case-insensitive and supports substring matching.
Types ¶
type Command ¶
type Command struct {
Name string // Display name of the command
Description string // Brief description of what the command does
Shortcut string // Keyboard shortcut (e.g., "r", "Ctrl+S")
Action func() tea.Msg // Function to execute when command is selected
}
Command represents a single command that can be executed from the palette.
func DefaultCommands ¶
func DefaultCommands() []Command
DefaultCommands returns the standard set of commands for memtui.
func RankCommands ¶
RankCommands ranks commands by their fuzzy match score against the query. It returns commands sorted by score (highest first).
type CommandCancelMsg ¶
type CommandCancelMsg struct{}
CommandCancelMsg is sent when the command palette is canceled (Escape).
type CommandExecuteMsg ¶
type CommandExecuteMsg struct {
Command Command
}
CommandExecuteMsg is sent when a command is executed from the palette.
type CommandPalette ¶
type CommandPalette struct {
// contains filtered or unexported fields
}
CommandPalette is a VS Code-style command palette component.
func New ¶
func New(commands []Command) *CommandPalette
New creates a new CommandPalette with the given commands.
func (*CommandPalette) SelectedCommand ¶
func (p *CommandPalette) SelectedCommand() *Command
SelectedCommand returns the currently selected command, or nil if none.
func (*CommandPalette) SetSize ¶
func (p *CommandPalette) SetSize(width, height int)
SetSize sets the dimensions for the command palette.
func (*CommandPalette) Show ¶
func (p *CommandPalette) Show()
Show makes the command palette visible.
func (*CommandPalette) Toggle ¶
func (p *CommandPalette) Toggle()
Toggle toggles the command palette visibility.
func (*CommandPalette) Visible ¶
func (p *CommandPalette) Visible() bool
Visible returns whether the command palette is currently visible.
type CopyValueMsg ¶
type CopyValueMsg struct{}
CopyValueMsg requests copying the current value to clipboard.
type RefreshKeysMsg ¶
type RefreshKeysMsg struct{}
RefreshKeysMsg requests the key list to be refreshed.
type ToggleThemeMsg ¶
type ToggleThemeMsg struct{}
ToggleThemeMsg requests toggling between light and dark themes.