Documentation
¶
Index ¶
- Constants
- func Score(query, text string) int
- type Command
- type CommandCancelMsg
- type CommandPalette
- func (p *CommandPalette) CenterInScreen(screenWidth, screenHeight int) string
- func (p *CommandPalette) HasTextInputFocused() bool
- func (p *CommandPalette) Init() tea.Cmd
- func (p *CommandPalette) Reset()
- func (p *CommandPalette) SetCommands(commands []Command)
- func (p *CommandPalette) SetProjectSelected(selected bool)
- func (p *CommandPalette) SetShowPrefix(show bool)
- func (p *CommandPalette) SetSize(width, height int)
- func (p *CommandPalette) Update(msg tea.Msg) tea.Cmd
- func (p *CommandPalette) View() string
- type CommandSelectedMsg
- type CommandType
- type RecentItem
- type RecentItemType
- type RecentTracker
- type Styles
- type ViewType
Constants ¶
const ( IconVM = "■" IconDisk = "●" IconImage = "◉" IconMetadata = "◐" IconBucket = "▪" IconVPC = "◆" IconFirewall = "▲" IconSubnet = "▫" IconSQLInstance = "⬢" IconServiceAccount = "▲" IconIAMPolicy = "▽" IconCustomRole = "▼" IconRoute = "→" IconCloudRun = "▶" IconLogs = "◆" IconRefresh = "↻" IconSidebar = "☰" IconHelp = "?" IconRecent = "⏱" IconProject = "◎" IconQuit = "✕" IconDemo = "▦" )
Icons for commands
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Command ¶
type Command struct {
ID string // Unique identifier: "nav:vm-instances", "action:refresh"
Label string // Display: "Compute Engine: VM instances"
Icon string // Unicode icon
Type CommandType
ViewType ViewType // For navigation commands
Action func() tea.Cmd // For action commands
Enabled bool // Whether command can be executed
}
Command represents an executable palette item
func DefaultCommands ¶
func DefaultCommands() []Command
DefaultCommands returns all default commands (navigation + actions)
func Filter ¶
Filter returns commands that match the query, sorted by relevance. Empty query returns all commands.
func NavigationCommands ¶
func NavigationCommands() []Command
NavigationCommands returns the navigation commands from sidebar menu
type CommandCancelMsg ¶
type CommandCancelMsg struct{}
CommandCancelMsg emitted when user cancels (Esc)
type CommandPalette ¶
type CommandPalette struct {
// contains filtered or unexported fields
}
CommandPalette is a fuzzy-searchable command selector
func (*CommandPalette) CenterInScreen ¶
func (p *CommandPalette) CenterInScreen(screenWidth, screenHeight int) string
CenterInScreen returns the styled palette centered on screen
func (*CommandPalette) HasTextInputFocused ¶
func (p *CommandPalette) HasTextInputFocused() bool
HasTextInputFocused returns true when the text input is focused. Used to prevent global keys (like 'q' for quit) from being triggered while typing.
func (*CommandPalette) Init ¶
func (p *CommandPalette) Init() tea.Cmd
Init initializes the command palette
func (*CommandPalette) Reset ¶
func (p *CommandPalette) Reset()
Reset resets the palette to initial state
func (*CommandPalette) SetCommands ¶
func (p *CommandPalette) SetCommands(commands []Command)
SetCommands sets the available commands
func (*CommandPalette) SetProjectSelected ¶
func (p *CommandPalette) SetProjectSelected(selected bool)
SetProjectSelected sets whether a project is selected (enables navigation commands)
func (*CommandPalette) SetShowPrefix ¶
func (p *CommandPalette) SetShowPrefix(show bool)
SetShowPrefix sets whether to show ":" prefix
func (*CommandPalette) SetSize ¶
func (p *CommandPalette) SetSize(width, height int)
SetSize updates the palette dimensions
func (*CommandPalette) Update ¶
func (p *CommandPalette) Update(msg tea.Msg) tea.Cmd
Update handles messages
func (*CommandPalette) View ¶
func (p *CommandPalette) View() string
View renders the command palette
type CommandSelectedMsg ¶
type CommandSelectedMsg struct {
Command Command
}
CommandSelectedMsg emitted when user selects a command
type CommandType ¶
type CommandType int
CommandType distinguishes different command behaviors
const ( CommandTypeAction // Execute an action (refresh, toggle) CommandTypeRecent // Recently accessed item )
type RecentItem ¶
type RecentItem struct {
Type RecentItemType
ID string // Resource ID
Label string // Display name
Timestamp time.Time // When it was accessed
}
RecentItem represents a recently accessed resource
type RecentItemType ¶
type RecentItemType string
RecentItemType identifies what kind of resource was accessed
const ( RecentTypeProject RecentItemType = "project" RecentTypeBucket RecentItemType = "bucket" RecentTypeInstance RecentItemType = "instance" RecentTypeDisk RecentItemType = "disk" RecentTypeSnapshot RecentItemType = "snapshot" RecentTypeImage RecentItemType = "image" )
type RecentTracker ¶
type RecentTracker struct {
// contains filtered or unexported fields
}
RecentTracker manages recently accessed items (in-memory)
func NewRecentTracker ¶
func NewRecentTracker() *RecentTracker
NewRecentTracker creates a new recent items tracker
func (*RecentTracker) Commands ¶
func (r *RecentTracker) Commands() []Command
Commands converts recent items to Command entries for the palette
func (*RecentTracker) Items ¶
func (r *RecentTracker) Items() []RecentItem
Items returns a copy of the recent items (most recent first)
func (*RecentTracker) SetMaxItems ¶
func (r *RecentTracker) SetMaxItems(maxItems int)
SetMaxItems sets the maximum number of recent items to track
func (*RecentTracker) Track ¶
func (r *RecentTracker) Track(itemType RecentItemType, id, label string)
Track adds or updates a recent item. If the item already exists, it moves to the top.
type Styles ¶
type Styles struct {
Container lipgloss.Style // Outer container with border
Input lipgloss.Style // Input line style
InputPrefix lipgloss.Style // The ":" prefix style
Separator lipgloss.Style // Line between input and results
List lipgloss.Style // Results list container
Item lipgloss.Style // Normal item
ItemSelected lipgloss.Style // Selected item
ItemDisabled lipgloss.Style // Disabled item (no project selected)
Icon lipgloss.Style // Icon style
IconDisabled lipgloss.Style // Disabled icon
Cursor lipgloss.Style // Selection cursor
NoResults lipgloss.Style // "No results" message
CategoryLabel lipgloss.Style // Category label for grouping (future)
}
Styles holds all command palette styles
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles returns the default command palette styles