MCPcopy Index your code
hub / github.com/databus23/helm-diff / formatPath

Function formatPath

diff/structured.go:354–374  ·  view source on GitHub ↗
(tokens []string)

Source from the content-addressed store, hash-verified

352}
353
354func formatPath(tokens []string) string {
355 if len(tokens) == 0 {
356 return ""
357 }
358 segments := []string{}
359 for _, token := range tokens {
360 if token == "" {
361 continue
362 }
363 if isArrayIndex(token) {
364 if len(segments) == 0 {
365 segments = append(segments, "["+token+"]")
366 } else {
367 segments[len(segments)-1] = segments[len(segments)-1] + "[" + token + "]"
368 }
369 continue
370 }
371 segments = append(segments, token)
372 }
373 return strings.Join(segments, ".")
374}
375
376func isArrayIndex(token string) bool {
377 if token == "" {

Callers 1

splitTokensFunction · 0.85

Calls 1

isArrayIndexFunction · 0.85

Tested by

no test coverage detected