mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-13 03:12:21 +01:00
grep: keep grep-flag-available together
This commit is contained in:
parent
b88039e0f4
commit
330f02a245
1 changed files with 4 additions and 5 deletions
|
|
@ -2,15 +2,14 @@
|
||||||
VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"
|
VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"
|
||||||
|
|
||||||
_setup_grep_alias() {
|
_setup_grep_alias() {
|
||||||
# Is grep argument $1 available?
|
|
||||||
grep-flag-available() {
|
|
||||||
echo | grep $1 "" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
local GREP_OPTIONS
|
local GREP_OPTIONS
|
||||||
# Color grep results.
|
# Color grep results.
|
||||||
GREP_OPTIONS=(--color=auto)
|
GREP_OPTIONS=(--color=auto)
|
||||||
|
|
||||||
|
# Is grep argument $1 available?
|
||||||
|
grep-flag-available() {
|
||||||
|
echo | grep $1 "" >/dev/null 2>&1
|
||||||
|
}
|
||||||
if grep-flag-available --exclude-dir=.cvs; then
|
if grep-flag-available --exclude-dir=.cvs; then
|
||||||
GREP_OPTIONS+=(--exclude-dir=$VCS_FOLDERS)
|
GREP_OPTIONS+=(--exclude-dir=$VCS_FOLDERS)
|
||||||
elif grep-flag-available --exclude=.cvs; then
|
elif grep-flag-available --exclude=.cvs; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue