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

Function parseKeyValues

cli/workspace/memory/store.go:697–720  ·  view source on GitHub ↗
(content string)

Source from the content-addressed store, hash-verified

695}
696
697func parseKeyValues(content string) map[string]string {
698 result := make(map[string]string)
699 lines := strings.Split(content, "\n")
700 for _, line := range lines {
701 line = strings.TrimSpace(line)
702 line = strings.TrimPrefix(line, "- ")
703 line = strings.TrimPrefix(line, "* ")
704
705 // Support KEY=VALUE and KEY: VALUE formats
706 var key, value string
707 if idx := strings.Index(line, "="); idx > 0 {
708 key = strings.TrimSpace(line[:idx])
709 value = strings.TrimSpace(line[idx+1:])
710 } else if idx := strings.Index(line, ":"); idx > 0 {
711 key = strings.TrimSpace(line[:idx])
712 value = strings.TrimSpace(line[idx+1:])
713 }
714
715 if key != "" && value != "" {
716 result[key] = value
717 }
718 }
719 return result
720}
721
722// parseTopics parses the TOPICS section into a name→summary map. It accepts the
723// new "name: summary" line format and the legacy bare/comma-separated names

Callers 1

parseEnhancedResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected