MCPcopy Index your code
hub / github.com/ddev/ddev / ColorizeText

Function ColorizeText

pkg/util/utils.go:319–334  ·  view source on GitHub ↗

ColorizeText colorizes text unless SimpleFormatting is turned on

(s string, c string)

Source from the content-addressed store, hash-verified

317
318// ColorizeText colorizes text unless SimpleFormatting is turned on
319func ColorizeText(s string, c string) (out string) {
320 if !output.ColorsEnabled() || output.JSONOutput {
321 text.DisableColors()
322 }
323 switch c {
324 case "green":
325 out = text.FgGreen.Sprint(s)
326 case "magenta":
327 out = text.FgMagenta.Sprint(s)
328 case "red":
329 out = text.FgRed.Sprint(s)
330 case "yellow":
331 out = text.FgYellow.Sprint(s)
332 }
333 return out
334}
335
336// Killall a process name on Linux/macOS/Windows.
337// Avoid this as it may have unintended consequences.

Callers 15

RenderRouterStatusFunction · 0.92
RenderAppRowFunction · 0.92
RenderSSHAuthStatusFunction · 0.92
projectNamePromptMethod · 0.92
docrootPromptMethod · 0.92
AppTypePromptMethod · 0.92
FormatSiteStatusFunction · 0.92
InfofMethod · 0.92
WarnfMethod · 0.92
ErrorfMethod · 0.92
tlsFailFunction · 0.92
createAppSnapshotFunction · 0.92

Calls 1

ColorsEnabledFunction · 0.92

Tested by

no test coverage detected