MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / catalogColumnIndexes

Function catalogColumnIndexes

internal/metadata/catalog.go:144–167  ·  view source on GitHub ↗
(header []string, kind entities.Kind)

Source from the content-addressed store, hash-verified

142}
143
144func catalogColumnIndexes(header []string, kind entities.Kind) (nameIdx, descIdx int, ok bool) {
145 nameIdx = -1
146 descIdx = -1
147 kindName := strings.ToLower(string(kind))
148 for i, cell := range header {
149 cleaned := strings.ToLower(cleanCatalogCell(cell))
150 switch {
151 case descIdx == -1 && strings.Contains(cleaned, "description"):
152 descIdx = i
153 case nameIdx == -1 && (strings.Contains(cleaned, kindName) || cleaned == "name"):
154 nameIdx = i
155 }
156 }
157 if nameIdx == -1 && len(header) > 0 {
158 nameIdx = 0
159 }
160 if descIdx == -1 && len(header) > 1 {
161 descIdx = 1
162 }
163 if nameIdx == descIdx {
164 descIdx = -1
165 }
166 return nameIdx, descIdx, nameIdx >= 0
167}
168
169func splitTableRow(line string) []string {
170 line = strings.TrimSpace(line)

Callers 1

parseCatalogMarkdownFunction · 0.85

Calls 1

cleanCatalogCellFunction · 0.85

Tested by

no test coverage detected