PrintErr shows a message to the user, colored in red for emphasis. It is printed over stderr as stdout is reserved for regular output.
(args ...interface{})
| 73 | // PrintErr shows a message to the user, colored in red for emphasis. |
| 74 | // It is printed over stderr as stdout is reserved for regular output. |
| 75 | func (r *readlineUI) PrintErr(args ...interface{}) { |
| 76 | text := fmt.Sprint(args...) |
| 77 | if !strings.HasSuffix(text, "\n") { |
| 78 | text += "\n" |
| 79 | } |
| 80 | if readline.IsTerminal(int(syscall.Stderr)) { |
| 81 | text = colorize(text) |
| 82 | } |
| 83 | fmt.Fprint(r.rl.Stderr(), text) |
| 84 | } |
| 85 | |
| 86 | // colorize the msg using ANSI color escapes. |
| 87 | func colorize(msg string) string { |
nothing calls this directly
no test coverage detected