Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1436448
| From | Josh Triplett <josh@joshtriplett.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: checkkconfigsymbols.py: add --no-color option |
| Date | 2016-07-04 14:30 +0200 |
| Message-ID | <rRbaG-5yi-27@gated-at.bofh.it> (permalink) |
| References | <rR7JM-3ot-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Jul 04, 2016 at 06:39:30PM +1000, Andrew Donnellan wrote: > Add a new option, --no-color, to get rid of ANSI colour escape codes in the > output. Useful if redirecting output to a file or piping to another script. > > (It should really be --no-colour, but I'll accept US spelling in the name > of consistency with existing usage in the code comments...) > > Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> > Acked-by: Valentin Rothberg <valentinrothberg@gmail.com> Rather than requiring an explicit option, how about detecting whether stdout is a TTY and automatically suppressing color? You could check "os.isatty(1)" in main(), and set a global "color = False". That would automatically handle the cases of redirecting to a file or piping to another script, without requiring the user to pass --no-color. - Josh Triplett
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] checkkconfigsymbols.py: add --no-color option Andrew Donnellan <andrew.donnellan@au1.ibm.com> - 2016-07-04 10:50 +0200
Re: [PATCH] checkkconfigsymbols.py: add --no-color option Valentin Rothberg <valentinrothberg@gmail.com> - 2016-07-04 12:50 +0200
Re: checkkconfigsymbols.py: add --no-color option Josh Triplett <josh@joshtriplett.org> - 2016-07-04 14:30 +0200
Re: checkkconfigsymbols.py: add --no-color option Andrew Donnellan <andrew.donnellan@au1.ibm.com> - 2016-07-05 09:30 +0200
[PATCH v2] checkkconfigsymbols.py: add --no-color option, don't print color to non-TTY Andrew Donnellan <andrew.donnellan@au1.ibm.com> - 2016-07-05 09:50 +0200
Re: [PATCH v2] checkkconfigsymbols.py: add --no-color option, don't print color to non-TTY Valentin Rothberg <valentinrothberg@gmail.com> - 2016-07-05 10:50 +0200
csiph-web