Last active
November 13, 2019 09:31
-
-
Save neroze/7ad28beba395e34c0812f55030a0eb41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# # iterm setting | |
# # open file link to sublime | |
# # Preferences -> Profile -> Advance -> Semantic History --> Alaway run comman == /usr/local/bin/sublime \1:\2 | |
# IGNORE_BUCKET="node_modules|out|grunt|build|scriptsDL|css|bower_components|.git|vendor|test" | |
# searchTestFile="--scope=test" | |
# if [[ $2 = $searchTestFile ]] | |
# then | |
# echo '###################### Searching inside test folders ############################' | |
# IGNORE_BUCKET="node_modules|out|grunt|build|scriptsDL|css|bower_components|.git|vendor" | |
# fi | |
# if [[ -z $1 ]]; then | |
# echo 'Required argument not provided, exiting...' | |
# exit 1 | |
# fi | |
# # ---------------------" | |
# # find and grep | |
# # find . -name "*js|*coffee" | grep -vE $IGNORE_BUCKET | xargs grep -En --color "$1" | |
# # find /path/to/ -iname '*.gif' -o -iname '*.jpg' -o -iname '*.png' -o -iname '*.jpeg' | |
# find "`pwd`" -regex ".*\.\(js\)" | grep -vE $IGNORE_BUCKET | xargs grep -En --color "$1" | |
# -------------------------- NEW Script ----------------------------- | |
IGNORE_BUCKET="node_modules|out|grunt|build|scriptsDL|css|bower_components|.git|vendor|test|build|coverage" | |
searchTestFile="--scope=test" | |
if [[ $2 = $searchTestFile ]] | |
then | |
echo '###################### Searching inside test folders ############################' | |
IGNORE_BUCKET="node_modules|out|grunt|build|scriptsDL|css|bower_components|.git|vendor|coverage" | |
fi | |
# IGNORE_BUCKET="node_modules|out|grunt|build|scriptsDL|css|bower_components|.git|vendor" | |
if [[ -z $1 ]]; then | |
echo 'Required argument not provided, exiting...' | |
exit 1 | |
fi | |
# ---------------------" | |
# find and grep | |
# find . -name "*js|*coffee" | grep -vE $IGNORE_BUCKET | xargs grep -En --color "$1" | |
# find /path/to/ -iname '*.gif' -o -iname '*.jpg' -o -iname '*.png' -o -iname '*.jpeg' | |
regx='.*(tsx|js)$' | |
# find "$PWD" -regex "$regx" | grep -vE $IGNORE_BUCKET | xargs grep -nE --color "$1" | |
# find -regextype posix-egrep -regex '.*(php|js)$' | |
find "$PWD" -regextype posix-egrep -regex "$regx" | grep -vE $IGNORE_BUCKET | xargs grep -nE --color "$1" | |
# find "$PWD" -regex ".*js" | grep -vE $IGNORE_BUCKET | xargs grep -nE --color "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment