()
| 81 | |
| 82 | |
| 83 | def main() -> int: |
| 84 | if not repo_path(README).is_file(): |
| 85 | print(f"FAILED: {display_path(README)} not found.") |
| 86 | return 1 |
| 87 | if not repo_path(INDEX).is_file(): |
| 88 | print(f"FAILED: {display_path(INDEX)} not found.") |
| 89 | return 1 |
| 90 | |
| 91 | readme_text = read_text(README) |
| 92 | index_text = read_text(INDEX) |
| 93 | |
| 94 | front_matter, _existing_body = split_front_matter(index_text) |
| 95 | new_index_text = build_index(front_matter, readme_text) |
| 96 | |
| 97 | if new_index_text == index_text: |
| 98 | print(f"{display_path(INDEX)} already in sync with {display_path(README)}.") |
| 99 | return 0 |
| 100 | |
| 101 | repo_path(INDEX).write_text(new_index_text, encoding="utf-8") |
| 102 | print(f"Updated {display_path(INDEX)} from {display_path(README)}.") |
| 103 | return 0 |
| 104 | |
| 105 | |
| 106 | if __name__ == "__main__": |
no test coverage detected