Documentation
¶
Index ¶
- Constants
- func AllCommands() []string
- func CalculateNewIndex(action NavigationAction, currentIndex, listLength, pageSize int) int
- func CompleteCommand(prefix string) (string, bool)
- func GetCommandSuggestions(prefix string) []string
- type Command
- type Mode
- type NavigationAction
- type State
- func (s *State) EnterCommandMode()
- func (s *State) EnterSearchMode()
- func (s *State) GetCurrentMatch() int
- func (s *State) GetMark(mark rune) (int, bool)
- func (s *State) HandleKey(msg tea.KeyMsg) bool
- func (s *State) NextMatch() int
- func (s *State) PrevMatch() int
- func (s *State) SearchItems(items []string)
- func (s *State) SetMark(mark rune, position int)
Constants ¶
const ( CmdQuit = "q" CmdQuitAll = "qa" CmdWrite = "w" CmdWriteQuit = "wq" CmdRefresh = "r" CmdHelp = "help" CmdClearFilter = "cf" CmdSelectAll = "sa" CmdDeselectAll = "da" CmdToggleDetails = "d" CmdEC2 = "ec2" CmdS3 = "s3" CmdEKS = "eks" CmdECS = "ecs" CmdECR = "ecr" CmdServices = "services" CmdAccount = "account" CmdRegion = "region" )
Common VIM commands for k9s-like interface
Variables ¶
This section is empty.
Functions ¶
func AllCommands ¶
func AllCommands() []string
AllCommands returns a list of all available commands for completion
func CalculateNewIndex ¶
func CalculateNewIndex(action NavigationAction, currentIndex, listLength, pageSize int) int
CalculateNewIndex calculates the new index based on navigation action
func CompleteCommand ¶
CompleteCommand returns the completed command if there's only one match
func GetCommandSuggestions ¶
GetCommandSuggestions returns commands that match the given prefix
Types ¶
type Command ¶
Command represents a parsed VIM-style command
func ParseCommand ¶
ParseCommand parses a command string
type NavigationAction ¶
type NavigationAction int
NavigationAction represents a VIM navigation action
const ( NoAction NavigationAction = iota MoveUp MoveDown MoveTop MoveBottom MoveHalfPageUp MoveHalfPageDown MovePageUp MovePageDown EnterSearch NextSearchResult PrevSearchResult EnterCommand )
func ParseNavigation ¶
func ParseNavigation(msg tea.KeyMsg) NavigationAction
ParseNavigation parses a key press into a navigation action
type State ¶
type State struct {
Mode Mode
SearchQuery string
SearchResults []int // indices of matching items
CurrentMatch int // current position in SearchResults
CommandBuffer string
LastSearch string // for n/N navigation
MarkPosition map[rune]int // VIM marks (m{a-z})
}
State holds the VIM-like state for navigation
func (*State) EnterCommandMode ¶
func (s *State) EnterCommandMode()
EnterCommandMode activates command mode
func (*State) EnterSearchMode ¶
func (s *State) EnterSearchMode()
EnterSearchMode activates search mode
func (*State) GetCurrentMatch ¶
GetCurrentMatch returns the current match index
func (*State) SearchItems ¶
SearchItems performs a search on a list of items and updates SearchResults