-
Notifications
You must be signed in to change notification settings - Fork 21
/
main.py
24 lines (21 loc) · 729 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
import logging
from continuous_translation.file_processing import translate_files
from continuous_translation.git_integration import clone_repository
from continuous_translation.config import ConfigurationError, load_config
repo_path = "local_repo"
def main():
logging.basicConfig(level=logging.INFO)
try:
config = load_config()
except ConfigurationError as e:
logging.error(str(e))
return
# 克隆仓库
clone_repository(config["GIT_REPO_URL"], repo_path)
# 处理文件和翻译
translate_files(repo_path, config)
# move files to root
os.system(f"rm -rf {repo_path}/.git && mv {repo_path}/* . && rm -rf {repo_path}")
if __name__ == "__main__":
main()