This commit is contained in:
parent
7808a0b637
commit
202b742163
|
@ -0,0 +1,38 @@
|
||||||
|
import asyncio
|
||||||
|
from pathlib import Path
|
||||||
|
from tools.argtool import (load_config, parse_arguments, get_default_config,
|
||||||
|
merge_configs)
|
||||||
|
from Dt_report import generate_dt_report
|
||||||
|
from Jf_report import generate_jf_report
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = parse_arguments()
|
||||||
|
|
||||||
|
default_cfg = get_default_config()
|
||||||
|
|
||||||
|
# 读取配置文件(若存在)
|
||||||
|
file_cfg = {}
|
||||||
|
if Path(args.config_file).exists():
|
||||||
|
try:
|
||||||
|
file_cfg = load_config(args.config_file)
|
||||||
|
except Exception as e:
|
||||||
|
print(f'警告:加载配置文件失败 {e},使用默认配置')
|
||||||
|
|
||||||
|
merged = merge_configs(default_cfg, file_cfg, args)
|
||||||
|
|
||||||
|
# 补全必要目录
|
||||||
|
if not merged['json2']['shengcheng_dir']:
|
||||||
|
merged['json2']['shengcheng_dir'] = str(Path.cwd() / 'output')
|
||||||
|
|
||||||
|
Path(merged['json2']['shengcheng_dir']).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
if merged['json2']['choose_template'] == 'DT':
|
||||||
|
asyncio.run(generate_dt_report(merged['json1'], merged['json2']))
|
||||||
|
elif merged['json2']['choose_template'] == 'JF':
|
||||||
|
asyncio.run(generate_jf_report(merged['json1'], merged['json2']))
|
||||||
|
else:
|
||||||
|
print('指定了不存在的模板,请检查配置文件')
|
||||||
|
print('文档生成完毕')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue