MCPcopy Index your code
hub / github.com/cli/cli / Update

Method Update

internal/prompter/multi_select_with_search.go:219–250  ·  view source on GitHub ↗
(msg tea.Msg)

Source from the content-addressed store, hash-verified

217}
218
219func (m *multiSelectSearchField) Update(msg tea.Msg) (huh.Model, tea.Cmd) {
220 switch msg := msg.(type) {
221 case tea.BackgroundColorMsg:
222 m.hasDarkBg = msg.IsDark()
223
224 case msSearchResultMsg:
225 m.applySearchResult(msg.query, msg.result)
226 m.mode = msModeSelect
227 m.search.Blur()
228 return m, nil
229
230 case spinner.TickMsg:
231 if !m.loading {
232 break
233 }
234 var cmd tea.Cmd
235 m.spinner, cmd = m.spinner.Update(msg)
236 return m, cmd
237
238 case tea.KeyPressMsg:
239 if m.loading {
240 return m, nil // ignore keys while loading
241 }
242 switch m.mode {
243 case msModeSearch:
244 return m.updateSearch(msg)
245 case msModeSelect:
246 return m.updateSelect(msg)
247 }
248 }
249 return m, nil
250}
251
252func (m *multiSelectSearchField) updateSearch(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) {
253 switch {

Callers

nothing calls this directly

Calls 5

applySearchResultMethod · 0.95
updateSearchMethod · 0.95
updateSelectMethod · 0.95
BlurMethod · 0.80
UpdateMethod · 0.65

Tested by

no test coverage detected