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

Function printDiffRecords

diff/diff.go:486–514  ·  view source on GitHub ↗
(suppressedKinds []string, kind string, context int, diffs []difflib.DiffRecord, to io.Writer)

Source from the content-addressed store, hash-verified

484}
485
486func printDiffRecords(suppressedKinds []string, kind string, context int, diffs []difflib.DiffRecord, to io.Writer) {
487 for _, ckind := range suppressedKinds {
488 if ckind == kind {
489 str := fmt.Sprintf("+ Changes suppressed on sensitive content of type %s\n", kind)
490 _, _ = fmt.Fprint(to, ansi.Color(str, "yellow"))
491 return
492 }
493 }
494
495 if context >= 0 {
496 distances := calculateDistances(diffs)
497 omitting := false
498 for i, diff := range diffs {
499 if distances[i] > context {
500 if !omitting {
501 _, _ = fmt.Fprintln(to, "...")
502 omitting = true
503 }
504 } else {
505 omitting = false
506 printDiffRecord(diff, to)
507 }
508 }
509 } else {
510 for _, diff := range diffs {
511 printDiffRecord(diff, to)
512 }
513 }
514}
515
516func printDiffRecord(diff difflib.DiffRecord, to io.Writer) {
517 text := diff.Payload

Callers 2

assertDiffFunction · 0.85
printDiffReportFunction · 0.85

Calls 2

calculateDistancesFunction · 0.85
printDiffRecordFunction · 0.85

Tested by 1

assertDiffFunction · 0.68