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

Function printDiffRecord

diff/diff.go:516–531  ·  view source on GitHub ↗
(diff difflib.DiffRecord, to io.Writer)

Source from the content-addressed store, hash-verified

514}
515
516func printDiffRecord(diff difflib.DiffRecord, to io.Writer) {
517 text := diff.Payload
518
519 switch diff.Delta {
520 case difflib.RightOnly:
521 _, _ = fmt.Fprintf(to, "%s\n", ansi.Color("+ "+text, "green"))
522 case difflib.LeftOnly:
523 _, _ = fmt.Fprintf(to, "%s\n", ansi.Color("- "+text, "red"))
524 case difflib.Common:
525 if text == "" {
526 _, _ = fmt.Fprintln(to)
527 } else {
528 _, _ = fmt.Fprintf(to, "%s\n", " "+text)
529 }
530 }
531}
532
533// Calculate distance of every diff-line to the closest change
534func calculateDistances(diffs []difflib.DiffRecord) map[int]int {

Callers 1

printDiffRecordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected