ColorizeText colorizes text unless SimpleFormatting is turned on
(s string, c string)
| 317 | |
| 318 | // ColorizeText colorizes text unless SimpleFormatting is turned on |
| 319 | func 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. |
no test coverage detected