-
Notifications
You must be signed in to change notification settings - Fork 0
/
rename.sh
executable file
·30 lines (26 loc) · 1.41 KB
/
rename.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# This script is an example of handling renaming of golang packages and repositories.
set -ex
ORIGINAL="github.com\/mattn\/bsky"
NEW="github.com\/jlewi\/bsctl"
# Handle renaming of module
find ./ -name "*.go" -exec sed -i ".bak" "s/${ORIGINAL}/${NEW}/g" {} ";"
# Find and update all go.mod files
find ./ -name "go.mod" -exec sed -i ".bak" "s/${ORIGINAL}/${NEW}/g" {} ";"
# Update all makefile
find ./ -name "Makefile" -exec sed -i ".bak" "s/${ORIGINAL}/${NEW}/g" {} ";"
find ./ -name "*.bak" -exec rm {} ";"
exit 0
# These rule updates all go files
find ./ -name "*.go" -exec sed -i ".bak" "s/pkg.loadConfig/pkg.LoadConfig/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/pkg.stringp/pkg.Stringp/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/pkg.int64p/pkg.Int64p/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/stringp/Stringp/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/int64p/Int64p/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/makeXRPCC/MakeXRPCC/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/timep/Timep/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/printPost/PrintPost/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/config/Config/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/cfg.verbose/cfg.Verbose/g" {} ";"
find ./ -name "*.go" -exec sed -i ".bak" "s/cfg.prefix/cfg.Prefix/g" {} ";"
find ./ -name "*.bak" -exec rm {} ";"