After taking a further look at this, I think I've found a good
compromise solution: doing a test for 'STDOUT is a file' (rather than a
terminal) seems to work well.

i.e. testing "-f STDOUT" rather than "-t STDOUT" leads to the following:

1. colordiff file1 file2                - does the right thing (colours)
2. colordiff file1 file2 > my.patch     - does the right thing (no colours)
3. someprog | colordiff                 - does the right thing (colours)
4. someprog | colordiff | less -r       - does the right thing (colours)
5. colordiff file1 file2 | less -r      - does the right thing (colours)

where "the right thing" is the reasonably sensible expected behaviour.

I plan to introduce an option which will allow (2) above to also include
colours (some users may want it), but it will be off by default.

The above will behave sensibly whether colordiff is aliased to diff or
not, as far as I can see.

Dave.
-- 
Dave Ewart - [EMAIL PROTECTED] - jabber: [EMAIL PROTECTED] - freenode: davee
All email from me is now digitally signed, key from http://www.sungate.co.uk/
Fingerprint: AEC5 9360 0A35 7F66 66E9 82E4 9E10 6769 CD28 DA92

Attachment: signature.asc
Description: Digital signature

Reply via email to