Documentation
¶
Overview ¶
Package keys provides key binding definitions and utilities for the TUI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Quit = key.NewBinding( key.WithKeys("q", "ctrl+c"), key.WithHelp("q", "quit"), ) Help = key.NewBinding( key.WithKeys("?", "h"), key.WithHelp("?/h", "toggle help"), ) Back = key.NewBinding( key.WithKeys("esc"), key.WithHelp("esc", "go back"), ) ViewDetails = key.NewBinding( key.WithKeys("y"), key.WithHelp("y", "toggle details"), ) CopyName = key.NewBinding( key.WithKeys("n"), key.WithHelp("n", "copy name"), ) )
Global key bindings (always active)
var ( NextCategory = key.NewBinding( key.WithKeys("shift+right"), key.WithHelp("shift+→", "next category"), ) PrevCategory = key.NewBinding( key.WithKeys("shift+left"), key.WithHelp("shift+←", "previous category"), ) FilterList = key.NewBinding( key.WithKeys("/"), key.WithHelp("/", "filter list"), ) JumpTo = key.NewBinding( key.WithKeys(":"), key.WithHelp(":", "jump to category"), ) PasteFilter = key.NewBinding( key.WithKeys("p"), key.WithHelp("p", "paste as filter"), ) Confirm = key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "enter context"), ) )
Mode-specific key bindings
var ( // CopyObject is a key binding for copying the value of an item in the details view. CopyObject = key.NewBinding( key.WithKeys("o"), key.WithHelp("o", "copy object as JSON"), ) // CopyTenant is a key binding for copying the tenant ID in the tenant context. CopyTenant = key.NewBinding( key.WithKeys("t"), key.WithHelp("t", "copy tenant ocid"), ) )
Functions ¶
func CatContext ¶
CatContext returns the mapping of category and view mode to context-specific key bindings.
func DetailsModeKeys ¶
DetailsModeKeys returns a copy of the key bindings for details mode.
func GlobalKeys ¶
GlobalKeys returns a copy of the global key bindings (always active).
func ListModeKeys ¶
ListModeKeys returns a copy of the key bindings for list mode.
Types ¶
type KeyMap ¶
type KeyMap struct {
Global []key.Binding // always active
Mode []key.Binding // active for current UI mode
Context []key.Binding // category-specific and mode-specific (optional)
}
KeyMap holds key bindings for the TUI, composed of global, mode, and context (category+mode) keys.
func FullKeyMap ¶
func FullKeyMap() KeyMap
FullKeyMap returns a KeyMap with all unique keys in each section.
func ResolveKeys ¶
ResolveKeys returns the composed KeyMap for the given category and UI mode.
func (KeyMap) FullHelp ¶
FullHelp returns a full list of key bindings for help display, chunked per category.