(argv: list[str] | None = None)
| 119 | |
| 120 | |
| 121 | def main(argv: list[str] | None = None) -> int: |
| 122 | parser = argparse.ArgumentParser( |
| 123 | description=__doc__, |
| 124 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 125 | ) |
| 126 | parser.add_argument( |
| 127 | "path", |
| 128 | type=pathlib.Path, |
| 129 | help="Source path containing /Lib/ (file or directory)", |
| 130 | ) |
| 131 | |
| 132 | args = parser.parse_args(argv) |
| 133 | |
| 134 | try: |
| 135 | if args.path.is_dir(): |
| 136 | patch_directory(args.path) |
| 137 | else: |
| 138 | patch_file(args.path) |
| 139 | return 0 |
| 140 | except ValueError as e: |
| 141 | print(f"Error: {e}", file=sys.stderr) |
| 142 | return 1 |
| 143 | except FileNotFoundError as e: |
| 144 | print(f"Error: {e}", file=sys.stderr) |
| 145 | return 1 |
| 146 | |
| 147 | |
| 148 | if __name__ == "__main__": |
no test coverage detected