(argv: Sequence[str] | None = None)
| 63 | |
| 64 | |
| 65 | def main(argv: Sequence[str] | None = None) -> int: |
| 66 | parser = argparse.ArgumentParser() |
| 67 | parser.add_argument("paths", nargs="*") |
| 68 | args = parser.parse_args(argv) |
| 69 | ret = 0 |
| 70 | for path in args.paths: |
| 71 | with open(path, encoding="utf-8") as fd: |
| 72 | content = fd.read() |
| 73 | new_content = sort_whatsnew_note(content) |
| 74 | if content != new_content: |
| 75 | ret |= 1 |
| 76 | with open(path, "w", encoding="utf-8") as fd: |
| 77 | fd.write(new_content) |
| 78 | return ret |
| 79 | |
| 80 | |
| 81 | if __name__ == "__main__": |
no test coverage detected