X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fbuildor%2Ffind_in_code.sh;h=453cfa2da95d854fc26cb99ce17a8c541aad4f25;hb=a0b67f7b29d2e6d094212774fe19df17bb6f13e6;hp=3b9d9a13accc0e1d9ea9463fdaff35134e0da117;hpb=2ddb6288beebe5936a30b386671bd7713d9b658b;p=feisty_meow.git diff --git a/scripts/buildor/find_in_code.sh b/scripts/buildor/find_in_code.sh index 3b9d9a13..453cfa2d 100644 --- a/scripts/buildor/find_in_code.sh +++ b/scripts/buildor/find_in_code.sh @@ -1,4 +1,33 @@ #!/bin/bash seek="$1"; shift +if [ -z "$seek" ]; then + echo This script needs a pattern to look for in the current directory. + echo All code files here and in subdirectories will be searched for the + echo pattern. + exit 1 +fi +#hmmm: might be nice to support multiple directories... +# just need to pass them to find as an array maybe? +dir="$1"; shift +if [ -z "$dir" ]; then + dir=. +fi + +find "$dir" -type f \( -iname "*" \ + ! -iname "*.class" \ + ! -iname "*.dll" \ + ! -iname "*.exe" \ + ! -iname "entries" \ + ! -iname "*.git" \ + ! -iname "*.gz" \ + ! -iname "*.jar" \ + ! -iname "*.lib" \ + ! -iname "*.obj" \ + ! -iname "*.svn" \ + ! -iname "*.svn-base" \ + ! -iname "*.tar" \ + ! -iname "*.tmp" \ + ! -iname "*.zip" \) \ + -exec echo "\"{}\"" ';' | xargs grep -li "$seek" | grep -v "^\.\|\/\." + -find . -type f -exec echo "\"{}\"" ';' | grep -v '.obj' | grep -v '.class' | grep -v '.svn' | grep -v '.git' | grep -v '.exe' | xargs grep -li "$seek"