MCPcopy
hub / github.com/cli/cli / Update

Method Update

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

Source from the content-addressed store, hash-verified

205}
206
207func (m *multiSelectSearchField) Update(msg tea.Msg) (huh.Model, tea.Cmd) {
208 switch msg := msg.(type) {
209 case tea.BackgroundColorMsg:
210 m.hasDarkBg = msg.IsDark()
211
212 case msSearchResultMsg:
213 m.applySearchResult(msg.query, msg.result)
214 m.mode = msModeSelect
215 m.search.Blur()
216 return m, nil
217
218 case spinner.TickMsg:
219 if !m.loading {
220 break
221 }
222 var cmd tea.Cmd
223 m.spinner, cmd = m.spinner.Update(msg)
224 return m, cmd
225
226 case tea.KeyPressMsg:
227 if m.loading {
228 return m, nil // ignore keys while loading
229 }
230 switch m.mode {
231 case msModeSearch:
232 return m.updateSearch(msg)
233 case msModeSelect:
234 return m.updateSelect(msg)
235 }
236 }
237 return m, nil
238}
239
240func (m *multiSelectSearchField) updateSearch(msg tea.KeyPressMsg) (huh.Model, tea.Cmd) {
241 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