2021-03-21 18:25:10 +03:00
|
|
|
#!/bin/zsh
|
|
|
|
|
|
|
|
z-alt-grep() {
|
|
|
|
local -a a
|
2022-07-19 02:41:45 +03:00
|
|
|
local n
|
|
|
|
|
2021-03-21 18:25:10 +03:00
|
|
|
a=( ${(@s:|:)1} )
|
|
|
|
[ ${#a} = 0 ] && a=( "$1" )
|
2022-07-19 02:41:45 +03:00
|
|
|
n=${#a}
|
2021-03-21 18:25:10 +03:00
|
|
|
[ -z "$1" ] && n=0
|
|
|
|
case "$n" in
|
2024-01-27 00:10:58 +03:00
|
|
|
0 ) ;;
|
|
|
|
* )
|
|
|
|
z-alt-set-static \
|
|
|
|
"grep|-q -e ' ' ${ZSHU[d_conf]}/_.zsh" \
|
|
|
|
"$1" \
|
|
|
|
"GREP_OPTIONS='' command" \
|
2021-12-07 02:46:50 +03:00
|
|
|
;;
|
2021-03-21 18:25:10 +03:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
## TODO: add --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}
|
|
|
|
GREP_GNU='--color=auto'
|
|
|
|
|
|
|
|
z-alt-grep "grep ${GREP_GNU}|grep"
|
|
|
|
unfunction z-alt-grep
|
|
|
|
unset GREP_GNU
|
|
|
|
|
2024-01-27 00:10:58 +03:00
|
|
|
alias grep='grep '
|
2021-12-07 02:46:50 +03:00
|
|
|
alias egrep='grep -E '
|
|
|
|
alias fgrep='grep -F '
|