Check for a terminal before using escapes

Close #2627

Here's what I get from my terminal (Ubuntu 12.04) with this patch

```
$ sudo docker pull base | grep -v kweepa
Pulling repository base
b750fe79269d: Download complete
27cf78414709: Download complete
```

This change will affect output from:
* insert
* import
* push
* pull
* events
* export
* run

(Those are the commands which use `cli.stream()`)