Documentation
¶
Overview ¶
Package action is Cove's command registry — the keystone of the discoverability thesis (PRD §5.4). Every user action is a named entry here; the palette, the keybinding dispatcher, and (later) TOML rebinding and plugins all read this one data structure. An action that is not in the registry does not exist.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
ID string // "file.save"
Title string // "File: Save" — what the palette shows
Key string
When Context
Hidden bool // bound but not palette-listed (movement keys)
Do func(app any) tea.Cmd
}
Action is one named command. Key is the default binding in tea.KeyMsg.String() form ("ctrl+s", "shift+down", ...); empty means palette-only. Do returns a tea.Cmd (usually nil); the receiver is the app, passed as any to avoid an import cycle.
type Context ¶
type Context string
Context scopes a binding to whichever pane has focus. Global actions fire anywhere in edit mode.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Lookup ¶
Lookup resolves a key press for a focused context, falling back to Global. Returns nil if unbound.
func (*Registry) Owner ¶ added in v0.10.0
Owner returns the ID of a different action bound to key in a context that collides with when (same context, or Global on either side — Lookup falls back to Global, so those shadow each other). "" means no conflict.
func (*Registry) Palette ¶
Palette returns all palette-visible actions sorted by title, so the "Category:" prefixes group together instead of surfacing in whatever order newRegistry happens to declare them.