summaryrefslogtreecommitdiff
path: root/lib/grep.zsh
diff options
context:
space:
mode:
authorThe Linux Kitten <kitten@openbsdbox>2015-02-02 20:49:24 +0100
committerThe Linux Kitten <kitten@openbsdbox>2015-02-02 20:49:24 +0100
commitf2130fa1a3f440418a6c48f9bace43ce7443117f (patch)
tree13b840dcf9a48b940ad782492f358b720bae19a0 /lib/grep.zsh
parent550ccca91cb45fcf26a8f2c3c60da675b995e3f3 (diff)
downloadzsh-f2130fa1a3f440418a6c48f9bace43ce7443117f.tar.gz
zsh-f2130fa1a3f440418a6c48f9bace43ce7443117f.tar.bz2
zsh-f2130fa1a3f440418a6c48f9bace43ce7443117f.zip
Test if --color=auto is a valid option for grep
Diffstat (limited to 'lib/grep.zsh')
-rw-r--r--lib/grep.zsh6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/grep.zsh b/lib/grep.zsh
index 348ebe623..3fa103d19 100644
--- a/lib/grep.zsh
+++ b/lib/grep.zsh
@@ -3,8 +3,12 @@ grep-flag-available() {
echo | grep $1 "" >/dev/null 2>&1
}
+GREP_OPTIONS=""
+
# color grep results
-GREP_OPTIONS="--color=auto"
+if grep-flag-available --color=auto; then
+ GREP_OPTIONS+=" --color=auto"
+fi
# ignore VCS folders (if the necessary grep flags are available)
VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"