[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Colored output
From: |
Jim Meyering |
Subject: |
Re: Colored output |
Date: |
Sun, 27 Jan 2019 08:22:20 -0800 |
On Sun, Jan 27, 2019 at 7:53 AM Akim Demaille <address@hidden> wrote:
> I'd like to have colored diagnostics in Bison, I do feel on occasion it would
> make it easier to spot errors and warnings for instance.
>
> AFAICT, gnulib does not feature any module to help do this. Coreutils (ls)
> and GCC (maybe diffutils too) are probably good sources of inspiration, but
> am I missing something? Should I look elsewhere first? Would a gnulib
> module make sense?
Hi Akim,
I too would start with coreutils, noting that one must be careful to
handle signals, so that the terminal is not left in a bad state when
output is interrupted between a pair of set/reset escape sequences.
https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/ls.c#n1303
Today I was surprised to see that while grep and recent diffutils also
have --color support, grep lacks the signal-handling code that is
present in both coreutils and diffutils.
If you factor some of that code into gnulib, that would be a fine
opportunity to use it to fix grep.