MCPcopy Index your code
hub / github.com/cloudfoundry/cli / displayDiffForStrings

Method displayDiffForStrings

util/ui/ui_for_push.go:189–208  ·  view source on GitHub ↗
(offset string, header string, oldList []string, newList []string)

Source from the content-addressed store, hash-verified

187}
188
189func (ui UI) displayDiffForStrings(offset string, header string, oldList []string, newList []string) {
190 fmt.Fprintf(ui.Out, " %s\n", ui.TranslateText(header))
191
192 fullList := sortedUniqueArray(oldList, newList)
193 for _, item := range fullList {
194 inOld := existsIn(item, oldList)
195 inNew := existsIn(item, newList)
196
197 switch {
198 case inOld && inNew:
199 fmt.Fprintf(ui.Out, " %s\n", item)
200 case inOld:
201 formattedOld := fmt.Sprintf("- %s", item)
202 fmt.Fprintln(ui.Out, ui.modifyColor(formattedOld, color.New(color.FgRed)))
203 default:
204 formattedNew := fmt.Sprintf("+ %s", item)
205 fmt.Fprintln(ui.Out, ui.modifyColor(formattedNew, color.New(color.FgGreen)))
206 }
207 }
208}
209
210func (ui UI) displayDiffForUint64(offset string, header string, oldValue uint64, newValue uint64) {
211 if oldValue != newValue {

Callers 1

DisplayChangeForPushMethod · 0.95

Calls 4

TranslateTextMethod · 0.95
modifyColorMethod · 0.95
sortedUniqueArrayFunction · 0.85
existsInFunction · 0.85

Tested by

no test coverage detected