[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#396485: diff & sdiff: please allow full-color output (fwd)

From: Matthew Woehlke
Subject: Re: Bug#396485: diff & sdiff: please allow full-color output (fwd)
Date: Wed, 15 Nov 2006 11:11:02 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20061025 Thunderbird/ Mnenhy/

Santiago Vila wrote:
It would be great if diff and/or sdiff could show their output in color.

...you could pick the most convenient option for the most users:
you could show color automatically if stdout is an interactive
terminal as opposed to a pipe.

Well, I for one like this idea. Given that 'ls' and 'grep' do it, I don't think it is unprecedented.

Note some standards (based on 'ls' and 'grep') that should apply:

- The option is '--color[=_when_]', where _when_ is 'yes'/'always', 'no'/'never', 'tty'/'auto', with 'auto' being default if --color is specified and 'no' otherwise. The option '--colour[=_when_]' (in grep, but not in ls) may optionally be a synonym.

- The environment variable DIFF_COLOR specifies what colors should be used.

- The correct way to enable color by default is with a system-wide alias. This is a distribution decision; when coding, do not consider this.

Alternatively, if this is not suitable for 'diff' itself, it might be an excellent candidate for the currently-proposed miscutils project (see the coreutils list), since it is relatively easy to do this with the help of 'sed'.

"Inches: An antiquated measurement unit still in use in certain backwards countries with incredibly low-cost computer equipment."
  -- groff documentation

reply via email to

[Prev in Thread] Current Thread [Next in Thread]