Ai
1 Star 0 Fork 20

keshui/AzurLaneAutoScript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
set.py 851 Bytes
一键复制 编辑 原始数据 按行查看 历史
huzb1 提交于 2022-10-08 20:43 +08:00 . 1
import sys
import typing as t
from deploy.utils import poor_yaml_read, poor_yaml_write, DEPLOY_TEMPLATE
"""
Set config/deploy.yaml with commands like
python -m deploy.set GitExecutable=/usr/bin/git PythonExecutable=/usr/bin/python3.8
"""
def get_args() -> t.Dict[str, str]:
args = {}
for arg in sys.argv[1:]:
if '=' not in arg:
continue
k, v = arg.split('=')
k, v = k.strip(), v.strip()
args[k] = v
return args
def config_set(output='./config/deploy.yaml'):
data = poor_yaml_read(DEPLOY_TEMPLATE)
data.update(poor_yaml_read(output))
for k, v in get_args().items():
if k in data:
print(f'{k} set')
data[k] = v
else:
print(f'{k} not exist')
poor_yaml_write(data, file=output)
if __name__ == '__main__':
config_set()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/keshui2021/AzurLaneAutoScript.git
git@gitee.com:keshui2021/AzurLaneAutoScript.git
keshui2021
AzurLaneAutoScript
AzurLaneAutoScript
master

搜索帮助