cloudfoundry/cli — pull request #135 by julz (2014-04-04 14:48:26+00:00)
Title: Disable CF_COLOR when not in a tty

Following on from the [gcf and colours discussion] (https://groups.google.com/a/cloudfoundry.org/forum/#!msg/vcap-dev/3rwzl8RQnWU/kQ_-PR4DlO8J) in vcap-dev.

As @nebhale says in the above discussion, "Many other command line interfaces that have color notice when they are being run via script versus in a tty and act accordingly. This is why tools like Git can produce colors, but their output can also be used when scripting without having to set a special flag. It'd be nice if gcf would do the same.". This makes gcf do the same.

This only changes what happens when CF_COLOR is not specified. CF_COLOR=true continues to be the effective default on non-windows systems when running in a tty. But when NOT in a tty, after this change CF_COLOR effectively defaults to false (but you can still explicitly enable colours in this case by setting it to true, rather than leaving it empty). CF_COLOR=false (still) always disables, CF_COLOR=true (still) always enables (unless you're on windows). Not specifying CF_COLOR (or setting it empty) does something intelligent based on whether stdout is a terminal.