From ea0cecd9e478681721182eb3703c86466c752e79 Mon Sep 17 00:00:00 2001 From: Taesu Lee Date: Wed, 28 Oct 2020 11:05:18 +0900 Subject: [PATCH] Add "ktgrep" for Kotlin New ktgrep is added and sgrep/treegrep also scan *.kt files. Test: kgrep/sgrep/treegrep for Kotlin files. Signed-off-by: Taesu Lee Change-Id: Ie615aa86c4958310785392f18ee7bddaf64706a9 --- envsetup.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/envsetup.sh b/envsetup.sh index 58fcd3be6..344a01af0 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -23,6 +23,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y - ggrep: Greps on all local Gradle files. - gogrep: Greps on all local Go files. - jgrep: Greps on all local Java files. +- ktgrep: Greps on all local Kotlin files. - resgrep: Greps on all local res/*.xml files. - mangrep: Greps on all local AndroidManifest.xml files. - mgrep: Greps on all local Makefiles and *.bp files. @@ -1002,7 +1003,7 @@ case `uname -s` in Darwin) function sgrep() { - find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|hpp|S|java|xml|sh|mk|aidl|vts|proto)' \ + find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|hpp|S|java|kt|xml|sh|mk|aidl|vts|proto)' \ -exec grep --color -n "$@" {} + } @@ -1010,7 +1011,7 @@ case `uname -s` in *) function sgrep() { - find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|hpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\|proto\)' \ + find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|hpp\|S\|java\|kt\|xml\|sh\|mk\|aidl\|vts\|proto\)' \ -exec grep --color -n "$@" {} + } ;; @@ -1045,6 +1046,12 @@ function rsgrep() -exec grep --color -n "$@" {} + } +function ktgrep() +{ + find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.kt" \ + -exec grep --color -n "$@" {} + +} + function cgrep() { find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \) \ @@ -1093,7 +1100,7 @@ case `uname -s` in function treegrep() { - find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|hpp|S|java|xml)' \ + find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|hpp|S|java|kt|xml)' \ -exec grep --color -n -i "$@" {} + } @@ -1107,7 +1114,7 @@ case `uname -s` in function treegrep() { - find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|hpp|S|java|xml)' -type f \ + find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|hpp|S|java|kt|xml)' -type f \ -exec grep --color -n -i "$@" {} + }