MCPcopy
hub / github.com/cli/cli / updateSearch

Method updateSearch

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

Source from the content-addressed store, hash-verified

238}
239
240func (m *multiSelectSearchField) updateSearch(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) {
241 switch {
242 case key.Matches(msg, key.NewBinding(key.WithKeys("enter", "tab"))):
243 query := m.search.Value()
244 if query == m.lastQuery {
245 // Query unchanged — just switch to select mode.
246 m.mode = msModeSelect
247 m.search.Blur()
248 return m, nil
249 }
250 // New query — clear input and search in background with spinner.
251 m.search.SetValue("")
252 return m, m.startSearch(query)
253
254 case key.Matches(msg, key.NewBinding(key.WithKeys("shift+tab"))):
255 return m, huh.PrevField
256
257 default:
258 var cmd tea.Cmd
259 m.search, cmd = m.search.Update(msg)
260 return m, cmd
261 }
262}
263
264func (m *multiSelectSearchField) updateSelect(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) {
265 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