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

Method applyFilter

pkg/cmd/extension/browse/model.go:408–427  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

406}
407
408func (m *browseModel) applyFilter() bool {
409 previous, hadPrevious := m.selectedEntry()
410 filter := m.filterInput.Value()
411 m.filtered = m.filtered[:0]
412 for i, entry := range m.entries {
413 searchable := entry.FullName + entry.Description()
414 if entry.Official {
415 searchable += " official"
416 }
417 if entry.Installed {
418 searchable += " installed"
419 }
420 if filter == "" || strings.Contains(searchable, filter) {
421 m.filtered = append(m.filtered, i)
422 }
423 }
424 m.cursor = 0
425 selected, hasSelected := m.selectedEntry()
426 return hadPrevious != hasSelected || previous.FullName != selected.FullName
427}
428
429func (m *browseModel) setInstalled(fullName string, installed bool) {
430 for i := range m.entries {

Callers 1

UpdateMethod · 0.95

Calls 4

selectedEntryMethod · 0.95
ValueMethod · 0.80
DescriptionMethod · 0.80
ContainsMethod · 0.80

Tested by

no test coverage detected