Created
July 25, 2014 06:15
-
-
Save goooooouwa/0de4adddc0a0dd7a024d to your computer and use it in GitHub Desktop.
little bash script to replace all occurrences of the first command line argument in the given directories. It will display the diff and then ask to commit.
This file contains 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 | |
eval 'find app/views app/controllers app/models -type f -exec sed -i "s/ $1[^s\"]/ ConstrBase::&/g" {} \;' | |
eval 'find app/views app/controllers app/models -type f -exec sed -i "s/ConstrBase:: $1/ConstrBase::$1/g" {} \;' | |
git diff | |
echo -n "Here be dragons. Continue?" | |
read REPLY | |
if [[ "$REPLY" =~ ^[Yy]$ ]] | |
then | |
git add . | |
eval "git cm 'fix: finish up all replacements of $1 with ConstrBase::$1'" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment