color by default

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: color by default
Date: 2019-12-31 10:40:28
Message-ID: bbdcce43-bd2e-5599-641b-9b44b9e0add4@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

With the attached patch, I propose to enable the colored output by
default in PG13.

For those who don't like color output, I also add support for the
environment variable NO_COLOR, which is an emerging standard for turning
off color across different software packages (https://no-color.org/).
Of course, you can also continue to use the PG_COLOR variable.

I have looked around how other packages do the automatic color
detection. It's usually a combination of mysterious termcap stuff and
slightly less mysterious matching of the TERM variable against a list of
known terminal types. I figured we can skip the termcap stuff and still
get really good coverage in practice, so that's what I did.

I have also added a documentation appendix to explain all of this.
(Perhaps we should now remove the repetitive mention of the PG_COLOR
variable in each man page, but I haven't done that in this patch.)

I'm aware of the pending patch to improve color support on Windows.
I'll check that one out as well, but it appears to be orthogonal to this
one.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-Use-colors-by-default.patch text/plain 6.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-12-31 10:56:26 Re: [PATCH] Fix PostgreSQL 12.1 server build and install problems under MSYS2
Previous Message Maxim Orlov 2019-12-31 10:16:49 [PATCH] lazy relations delete