From: Phil Sutter <phil@nwl.cc>
To: David Ahern <dsahern@gmail.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
netdev@vger.kernel.org, Till Maas <opensource@till.name>
Subject: Re: [iproute PATCH v2 4/4] lib: Enable colored output only for TTYs
Date: Wed, 15 Aug 2018 18:39:44 +0200 [thread overview]
Message-ID: <20180815163944.GT32448@orbyte.nwl.cc> (raw)
In-Reply-To: <06633975-40ae-f3d6-b5a9-8a947752e400@gmail.com>
On Wed, Aug 15, 2018 at 10:24:31AM -0600, David Ahern wrote:
> On 8/15/18 10:21 AM, Phil Sutter wrote:
> > Add an additional prerequisite to check_enable_color() to make sure
> > stdout actually points to an open TTY device. Otherwise calls like
> >
> > | ip -color a s >/tmp/foo
> >
> > will print color escape sequences into that file. Allow to override this
> > check by specifying '-color' flag more than once.
> >
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> > Changes since v1:
> > - Allow to override isatty() check by specifying '-color' flag more than
> > once.
>
> That adds overhead to my workflow where I almost always have to pipe the
> output of ip to a pager.
alias ip='ip -color -color'
Another alternative may be to introduce -autocolor flag. Establishing
the same syntax as used by 'ls' is not as trivial due to the simple
commandline parsing used in 'ip'.
Cheers, Phil
next prev parent reply other threads:[~2018-08-15 19:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-15 16:21 [iproute PATCH v2 0/4] A bunch of fixes regarding colored output Phil Sutter
2018-08-15 16:21 ` [iproute PATCH 1/4] tc: Fix typo in check for " Phil Sutter
2018-08-15 16:21 ` [iproute PATCH 2/4] bridge: Fix " Phil Sutter
2018-08-15 16:21 ` [iproute PATCH 3/4] Merge common code for conditionally " Phil Sutter
2018-08-15 16:21 ` [iproute PATCH v2 4/4] lib: Enable colored output only for TTYs Phil Sutter
2018-08-15 16:24 ` David Ahern
2018-08-15 16:39 ` Phil Sutter [this message]
2018-08-15 16:43 ` David Ahern
2018-08-15 16:51 ` Phil Sutter
2018-08-15 16:57 ` David Ahern
2018-08-15 17:58 ` Phil Sutter
2018-08-15 19:30 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180815163944.GT32448@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=opensource@till.name \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).