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

Method DisplayTextWithFlavor

util/ui/ui.go:277–286  ·  view source on GitHub ↗

DisplayTextWithFlavor translates the template, bolds and adds cyan color to templateValues, substitutes templateValues into the template, and outputs the result to ui.Out. Only the first map in templateValues is used.

(template string, templateValues ...map[string]interface{})

Source from the content-addressed store, hash-verified

275// templateValues, substitutes templateValues into the template, and outputs
276// the result to ui.Out. Only the first map in templateValues is used.
277func (ui *UI) DisplayTextWithFlavor(template string, templateValues ...map[string]interface{}) {
278 ui.terminalLock.Lock()
279 defer ui.terminalLock.Unlock()
280
281 firstTemplateValues := getFirstSet(templateValues)
282 for key, value := range firstTemplateValues {
283 firstTemplateValues[key] = ui.modifyColor(fmt.Sprint(value), color.New(color.FgCyan, color.Bold))
284 }
285 fmt.Fprintf(ui.Out, "%s\n", ui.TranslateText(template, firstTemplateValues))
286}
287
288func getIndent(depth int, addHyphen bool) string {
289 if depth == 0 {

Callers

nothing calls this directly

Calls 3

modifyColorMethod · 0.95
TranslateTextMethod · 0.95
getFirstSetFunction · 0.85

Tested by

no test coverage detected