MCPcopy Create free account
hub / github.com/cli/cli / updateSearch

Method updateSearch

internal/prompter/multi_select_with_search.go:252–274  ·  view source on GitHub ↗
(msg tea.KeyPressMsg)

Source from the content-addressed store, hash-verified

250}
251
252func (m *multiSelectSearchField) updateSearch(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) {
253 switch {
254 case key.Matches(msg, key.NewBinding(key.WithKeys("enter", "tab"))):
255 query := m.search.Value()
256 if query == m.lastQuery {
257 // Query unchanged — just switch to select mode.
258 m.mode = msModeSelect
259 m.search.Blur()
260 return m, nil
261 }
262 // New query — clear input and search in background with spinner.
263 m.search.SetValue("")
264 return m, m.startSearch(query)
265
266 case key.Matches(msg, key.NewBinding(key.WithKeys("shift+tab"))):
267 return m, huh.PrevField
268
269 default:
270 var cmd tea.Cmd
271 m.search, cmd = m.search.Update(msg)
272 return m, cmd
273 }
274}
275
276func (m *multiSelectSearchField) updateSelect(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) {
277 switch {

Callers 1

UpdateMethod · 0.95

Calls 5

startSearchMethod · 0.95
MatchesMethod · 0.80
ValueMethod · 0.80
BlurMethod · 0.80
UpdateMethod · 0.65

Tested by

no test coverage detected