Skip to content

Commit

Permalink
Merge pull request #3538 from TheLinuxKitten/grep-if-color
Browse files Browse the repository at this point in the history
Test if --color=auto is a valid option for grep
  • Loading branch information
robbyrussell committed Feb 22, 2015
2 parents e2fd99a + f2130fa commit ff6ca9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/grep.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit ff6ca9b

Please sign in to comment.