MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / update

Method update

internal/cli/tool_menu.go:51–82  ·  view source on GitHub ↗

update mutates the step in place and reports the high-level action. Returns pickerActionNone for filter/movement keys.

(msg tea.KeyMsg)

Source from the content-addressed store, hash-verified

49// update mutates the step in place and reports the high-level action.
50// Returns pickerActionNone for filter/movement keys.
51func (s *pickerStep) update(msg tea.KeyMsg) pickerAction {
52 switch msg.String() {
53 case "ctrl+c", "q":
54 return pickerActionAbort
55 case "esc":
56 return pickerActionBack
57 case "up", "k":
58 if s.cursor > 0 {
59 s.cursor--
60 }
61 case "down", "j":
62 if s.cursor < len(s.filtered())-1 {
63 s.cursor++
64 }
65 case "enter":
66 if len(s.filtered()) > 0 {
67 return pickerActionAdvance
68 }
69 case "backspace":
70 if s.filter != "" {
71 s.filter = s.filter[:len(s.filter)-1]
72 s.clampCursor()
73 }
74 default:
75 text := msg.String()
76 if len(text) == 1 && text != "/" {
77 s.filter += text
78 s.clampCursor()
79 }
80 }
81 return pickerActionNone
82}
83
84// selected returns the currently highlighted item, or "" when the
85// filtered list is empty.

Calls 2

filteredMethod · 0.95
clampCursorMethod · 0.95