home
/
code
/
khome.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add function regex matching to erlang code searcher
[khome.git]
/
home
/
bin
/
erlcode-find-calls-to-module
diff --git
a/home/bin/erlcode-find-calls-to-module
b/home/bin/erlcode-find-calls-to-module
index
8e4d9e5
..
a3a8685
100755
(executable)
--- a/
home/bin/erlcode-find-calls-to-module
+++ b/
home/bin/erlcode-find-calls-to-module
@@
-1,12
+1,16
@@
#! /bin/bash
target_module="$1"
#! /bin/bash
target_module="$1"
-shift
+target_fun_regex="$2"
+shift 2
dirs=$@
find $dirs -type f -name '*.erl' -exec grep -Hn "\<$target_module\>:" '{}' \; \
| sed 's/%.*$//g' \
dirs=$@
find $dirs -type f -name '*.erl' -exec grep -Hn "\<$target_module\>:" '{}' \; \
| sed 's/%.*$//g' \
-| awk -F "${target_module}:" -v target_module="$target_module" '
+| awk \
+ -F "${target_module}:" \
+ -v target_module="$target_module" \
+ -v target_fun_regex="$target_fun_regex" '
$1 && $2 {
caller_module_file = $1
sub(":.*$", "", caller_module_file)
$1 && $2 {
caller_module_file = $1
sub(":.*$", "", caller_module_file)
@@
-32,7
+36,7
@@
find $dirs -type f -name '*.erl' -exec grep -Hn "\<$target_module\>:" '{}' \; \
print caller_module_file;
for (cf in Calls_from) {
split(cf, call, SUBSEP);
print caller_module_file;
for (cf in Calls_from) {
split(cf, call, SUBSEP);
- if (call[1] == caller_module_file)
+ if (call[1] == caller_module_file
&& call[2] ~ target_fun_regex
)
printf "%s%s\n", indent, call[2] | "sort";
}
close("sort")
printf "%s%s\n", indent, call[2] | "sort";
}
close("sort")
This page took
0.025771 seconds
and
4
git commands to generate.