I have a bash script I got from Gary Bernhardt's dotfiles that prints a nice colorized listing of the recent git commits. It uses the column
command to line the output up into columns. On my mac, it works wonderfully.
Strangely however, when I run it on Cygwin or CentOS 6, the column bit doesn't work. All the fields have three spaces between them, regardless of their length, producing jagged gutters between "columns". I've narrowed it down to the ANSI Color escape codes. If I remove those, the columns come out lined up.
The zsh version is the same on all three (and the problem appears exactly the same way in bash). I can't tell what the version of column
is, but they look exactly the same and their man pages are the same for whatever that's worth.
Why would this work on my Mac but not on the other OS'es?
Best Answer
Possibly the
column
command looks at$TERM
and/or$LANG
to see what (if anything) constitutes a colour-code.Of course, you could just use
git log --pretty=format:...
to output a column-aligned colour-coded log to begin with. For example, I usegit hist
and have this in my~/.git/config
: