This commit is contained in:
hophacker 2017-11-21 18:00:08 +08:00 committed by rallets
parent 5cfdefb57c
commit b2f9e89ba3

View File

@ -139,15 +139,12 @@ function strip_color() {
function docker_rm_all() { function docker_rm_all() {
docker rm -f `docker ps --no-trunc -aq` docker rm -f `docker ps --no-trunc -aq`
} }
function recursive_replace { function Replace {
if [ "$#" -ne 3 ]; then if [ "$#" -eq 3 ]; then
echo "recursive_replace \"FILE_PATTERN\" BEFORE AFTER" ag $2 -l -G $1 | xargs sed -i '' s/$2/$3/g
return elif [ "$#" -eq 2 ]; then
ag $1 -l | xargs sed -i '' s/$1/$2/g
fi fi
print "Filename's regex pattern is: $1"
print "String to be replaced: $2"
print "String replaced to: $3"
find -iregex $1 -type f -exec sed -i "s/$2/$3/g" {} +
} }
function git-change-module-remote() { function git-change-module-remote() {
git config --file=.gitmodules submodule.$1.url $2 git config --file=.gitmodules submodule.$1.url $2