20 lines
688 B
Python
20 lines
688 B
Python
with open(r"E:\GitHub\blog\bot-go\cmd\writebot\main.go", "r", encoding="utf-8", errors="replace") as f:
|
|||
|
|
content = f.read()
|
||
|
|
|
||
|
|
# 1. Remove writeconfig line
|
||
|
|
import re
|
||
|
|
content = re.sub(r'\t+writeconfig "write-server/internal/config"\r?\n', '', content)
|
||
|
|
|
||
|
|
# 2. Replace writeconfig.Init() with posts.Init()
|
||
|
|
content = content.replace('writeconfig.Init()', 'posts.Init()')
|
||
|
|
|
||
|
|
# 3. Add posts import after writeserver
|
||
|
|
content = content.replace(
|
||
|
|
'"writebot/internal/writeserver"',
|
||
|
|
'"writebot/internal/writeserver"\n\t"write-server/pkg/posts"'
|
||
|
|
)
|
||
|
|
|
||
|
|
with open(r"E:\GitHub\blog\bot-go\cmd\writebot\main.go", "w", encoding="utf-8", errors="replace") as f:
|
||
|
|
f.write(content)
|
||
|
|
|
||
|
|
print("Done")
|