[zsh] more grep function

This commit is contained in:
Mathieu Maret 2015-11-25 11:35:22 +01:00
parent 2c78121c1e
commit fb60eb255f
2 changed files with 18 additions and 4 deletions

View File

@ -21,7 +21,7 @@ alias xte='nohup xterm &' # xte lancera un xterm qui ne se fermera pas si on fer
alias minicom='minicom -c on'
alias vims='vim --servername vimserver'
alias vimo='vim --servername vimserver --remote-tab'
alias agrep='grep --exclude=.git --exclude-dir=out --exclude-dir=prebuilts --exclude-dir=docs'
alias agrep='grep --exclude=.git --exclude-dir=out --exclude-dir=prebuilts --exclude-dir=docs --exclude=tags --exclude=cscope.out'
#Extension Alias
alias -s html=$BROWSER

View File

@ -110,11 +110,25 @@ resgrep () {
for dir in `find . -name .repo -prune -o -name .git -prune -o -name res -type d`
do
find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"
done
done
}
gettop ()
{
sgrep() {
find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|S|java|xml|sh|mk|aidl)' -print0 | xargs -0 grep --color -n "$@"
}
mangrep() {
find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -name 'AndroidManifest.xml' -print0 | xargs -0 grep --color -n "$@"
}
sepgrep() {
find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -name sepolicy -type d -print0 | xargs -0 grep --color -n -r --exclude-dir=\.git "$@"
}
gettop ()
{
local TOPFILE=build/core/envsetup.mk;
if [ -n "$TOP" -a -f "$TOP/$TOPFILE" ]; then
echo $TOP;