commandpalette

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string
	Description string
	Action      func() tea.Cmd
}

Command represents a command that can be executed

type ExecutedMsg

type ExecutedMsg struct {
	Command string
	Data    interface{}
}

ExecutedMsg is sent when a command is executed

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model represents the command palette state

func New

func New() Model

New creates a new command palette model

func (*Model) Hide

func (m *Model) Hide()

Hide makes the command palette invisible

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the command palette model

func (Model) IsVisible

func (m Model) IsVisible() bool

IsVisible returns whether the command palette is visible

func (*Model) RegisterCommand

func (m *Model) RegisterCommand(name, description string, action func() tea.Cmd)

RegisterCommand adds a new command to the palette

func (*Model) SetCommands added in v0.1.0

func (m *Model) SetCommands(commands []Command)

SetCommands replaces all commands in the palette.

func (*Model) SetMaxVisible added in v0.1.0

func (m *Model) SetMaxVisible(maxVisible int)

SetMaxVisible sets the maximum number of commands rendered in the list.

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize sets the dimensions for the command palette

func (*Model) Show

func (m *Model) Show()

Show makes the command palette visible

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update handles command palette updates

func (Model) View

func (m Model) View() string

View renders the command palette

func (Model) WithStyles

func (m Model) WithStyles(styles Styles) Model

WithStyles sets custom styles for the command palette

type Styles

type Styles struct {
	Palette            lipgloss.Style
	Header             lipgloss.Style
	Query              lipgloss.Style
	Command            lipgloss.Style
	SelectedCommand    lipgloss.Style
	CommandName        lipgloss.Style
	CommandDescription lipgloss.Style
	Help               lipgloss.Style
}

Styles defines the styling for the command palette

func DefaultStyles

func DefaultStyles() Styles

DefaultStyles returns the default styles for the command palette

Jump to

Keyboard shortcuts

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