1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-24 23:00:09 +00:00

Test if --color=auto is a valid option for grep

This commit is contained in:
The Linux Kitten 2015-02-02 20:49:24 +01:00
parent 550ccca91c
commit f2130fa1a3

View file

@ -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}"