Merge "Make jgrep, mgrep, etc not recurse into .repo and .git directories."
This commit is contained in:
commit
192c90b445
18
envsetup.sh
18
envsetup.sh
|
@ -812,55 +812,55 @@ case `uname -s` in
|
|||
Darwin)
|
||||
function sgrep()
|
||||
{
|
||||
find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml|sh|mk)' -print0 | xargs -0 grep --color -n "$@"
|
||||
find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml|sh|mk)' -print0 | xargs -0 grep --color -n "$@"
|
||||
}
|
||||
|
||||
;;
|
||||
*)
|
||||
function sgrep()
|
||||
{
|
||||
find . -type f -iregex '.*\.\(c\|h\|cpp\|S\|java\|xml\|sh\|mk\)' -print0 | xargs -0 grep --color -n "$@"
|
||||
find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cpp\|S\|java\|xml\|sh\|mk\)' -print0 | xargs -0 grep --color -n "$@"
|
||||
}
|
||||
;;
|
||||
esac
|
||||
|
||||
function jgrep()
|
||||
{
|
||||
find . -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
|
||||
find . -name .repo -prune -o -name .git -prune -o -type f -name "*\.java" -print0 | xargs -0 grep --color -n "$@"
|
||||
}
|
||||
|
||||
function cgrep()
|
||||
{
|
||||
find . -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
|
||||
find .a -name .repo -prune -o -name .git -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' \) -print0 | xargs -0 grep --color -n "$@"
|
||||
}
|
||||
|
||||
function resgrep()
|
||||
{
|
||||
for dir in `find . -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
|
||||
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;
|
||||
}
|
||||
|
||||
case `uname -s` in
|
||||
Darwin)
|
||||
function mgrep()
|
||||
{
|
||||
find -E . -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@"
|
||||
find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*/(Makefile|Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -print0 | xargs -0 grep --color -n "$@"
|
||||
}
|
||||
|
||||
function treegrep()
|
||||
{
|
||||
find -E . -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@"
|
||||
find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml)' -print0 | xargs -0 grep --color -n -i "$@"
|
||||
}
|
||||
|
||||
;;
|
||||
*)
|
||||
function mgrep()
|
||||
{
|
||||
find . -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@"
|
||||
find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '(.*\/Makefile|.*\/Makefile\..*|.*\.make|.*\.mak|.*\.mk)' -type f -print0 | xargs -0 grep --color -n "$@"
|
||||
}
|
||||
|
||||
function treegrep()
|
||||
{
|
||||
find . -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@"
|
||||
find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f -print0 | xargs -0 grep --color -n -i "$@"
|
||||
}
|
||||
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue