MCPcopy Create free account
hub / github.com/diillson/chatcli / removeItems

Function removeItems

cli/workspace/memory/profile_ops.go:288–304  ·  view source on GitHub ↗

removeItems drops entries matching ANY incoming item, by case-insensitive substring or by stem equality. Returns whether the list shrank.

(list *[]string, matchers []string)

Source from the content-addressed store, hash-verified

286// removeItems drops entries matching ANY incoming item, by case-insensitive
287// substring or by stem equality. Returns whether the list shrank.
288func removeItems(list *[]string, matchers []string) bool {
289 if len(matchers) == 0 {
290 return false
291 }
292 kept := make([]string, 0, len(*list))
293 for _, existing := range *list {
294 if entryMatchesAny(existing, matchers) {
295 continue
296 }
297 kept = append(kept, existing)
298 }
299 if len(kept) == len(*list) {
300 return false
301 }
302 *list = kept
303 return true
304}
305
306func entryMatchesAny(entry string, matchers []string) bool {
307 le := strings.ToLower(entry)

Callers 1

applyListOpMethod · 0.85

Calls 1

entryMatchesAnyFunction · 0.85

Tested by

no test coverage detected