add --color cli arg to override tty detection

This commit is contained in:
Andrew Kelley
2015-12-01 01:06:10 -07:00
parent 257cf09472
commit 29f24e3c50
9 changed files with 43 additions and 11 deletions

View File

@@ -8,8 +8,8 @@
#define GREEN "\x1b[32;1m"
#define RESET "\x1b[0m"
void print_err_msg(ErrorMsg *err) {
if (os_stderr_tty()) {
void print_err_msg(ErrorMsg *err, ErrColor color) {
if (color == ErrColorOn || (color == ErrColorAuto && os_stderr_tty())) {
fprintf(stderr, WHITE "%s:%d:%d: " RED "error:" WHITE " %s" RESET "\n",
buf_ptr(err->path),
err->line_start + 1, err->column_start + 1,