diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-19 14:49:09 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-19 14:49:09 +1200 |
commit | 198a50c1968e47e77c6c6f8ac5c73a9b9ff0af31 (patch) | |
tree | 9974e174a23a2e3cb623daef0c8ca206ac6c107b /bash | |
parent | Check term has colors before using in gcc (diff) | |
download | dotfiles-198a50c1968e47e77c6c6f8ac5c73a9b9ff0af31.tar.gz dotfiles-198a50c1968e47e77c6c6f8ac5c73a9b9ff0af31.zip |
make(1) wrapper deals with *_COLORS vars
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc.d/make.bash | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bash/bashrc.d/make.bash b/bash/bashrc.d/make.bash index df4c0f56..63ffa3f0 100644 --- a/bash/bashrc.d/make.bash +++ b/bash/bashrc.d/make.bash @@ -1,3 +1,21 @@ +# Unset all my *_COLORS vars when invoking make(1) if terminal doesn't have +# color; I have to do this because my wrapper functions are ignored by the +# /bin/sh fork make(1) does +make() { + local -i colors + colors=$( { + tput Co || tput colors + } 2>/dev/null ) + if ((colors >= 8)) ; then + command make "$@" + else + ( + unset -v GCC_COLORS GREP_COLORS LS_COLORS + command make "$@" + ) + fi +} + # Completion setup for Make, completing targets _make() { local word |