envsetup: Add pygrep function to grep all python files
Test: manual - searched .py files in shell
Change-Id: I6abd4615588ef0dbe7b46b0e9159bd814f63ed09
Signed-off-by: DroidFreak32 <rushabshah32@gmail.com>
diff --git a/envsetup.sh b/envsetup.sh
index 8856212..6e756ca 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -34,6 +34,7 @@
- rsgrep: Greps on all local Rust files.
- sepgrep: Greps on all local sepolicy files.
- sgrep: Greps on all local source files.
+- pygrep: Greps on all local Python files.
- godir: Go to the directory containing a file.
- allmod: List all modules.
- gomod: Go to the directory containing a module.
@@ -1256,6 +1257,12 @@
-exec grep --color -n "$@" {} +
}
+function pygrep()
+{
+ find . -name .repo -prune -o -name .git -prune -o -name out -prune -o -type f -name "*\.py" \
+ -exec grep --color -n "$@" {} +
+}
+
case `uname -s` in
Darwin)
function mgrep()