Skip to content

Instantly share code, notes, and snippets.

@starstuck
Created July 19, 2013 17:16
Show Gist options
  • Save starstuck/6040823 to your computer and use it in GitHub Desktop.
Save starstuck/6040823 to your computer and use it in GitHub Desktop.
Build etags from javascript files including names exposed using global namespace convention and properties assigned to prototype
#!/usr/bin/env sh
SYMBOL="[a-zA-Z_][a-zA-Z0-9_]*"
CAP_SYMBOL="[A-Z][a-zA-Z0-9_]*"
GLOB_SYMBOL="${CAP_SYMBOL}\(\.${SYMBOL}\)*"
if [ -z "$1" ]; then
echo "You need to provide at list one path where to search for js files" 1>&2
exit 1
fi
find ${@} -name *.js -print | etags \
--regex="/[ \t]*prototype\.\(${SYMBOL}\) *=/\1/" \
--regex="/[ \t]*${GLOB_SYMBOL}\.\(${SYMBOL}\) *=/\2/" \
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment