(script, scripts, start_tag, end_tag, group)
| 42 | |
| 43 | |
| 44 | def process_script(script, scripts, start_tag, end_tag, group): |
| 45 | # group 可以从script.get('group')获取,这里直接使用直接传递的 |
| 46 | script_directory = script.get('directory', '') |
| 47 | cnfile_path = os.path.join(script_directory, "README.md") |
| 48 | descriptions = generate_description(group, scripts, "zh-CN") |
| 49 | olddescriptions = get_file_description(cnfile_path, start_tag, end_tag) |
| 50 | if olddescriptions is None: |
| 51 | olddescriptions = "ggg" |
| 52 | if olddescriptions + "\n" == descriptions: |
| 53 | return |
| 54 | else: |
| 55 | print(f"----[\033[94m{script.get('name', '')}\033[0m--\033[95m{group}\033[0m]\033[92m 内容变化,执行替换\033[0m") |
| 56 | md_files = get_md_files(script_directory) |
| 57 | for file_name in md_files: |
| 58 | file_path = os.path.join(script_directory, file_name) |
| 59 | match = re.match(r'README_([a-zA-Z\-]+)\.md', file_name) |
| 60 | lang_code = match.group(1) if match else "zh-CN" |
| 61 | descriptions = generate_description(group, scripts, lang_code) |
| 62 | process_file_plus(file_path, descriptions, start_tag, end_tag, "<!--FOOTER-->") |
| 63 | |
| 64 | |
| 65 | def main(): |
no test coverage detected