| 1 | #!/usr/bin/env python3 |
| 2 | from __future__ import annotations |
| 3 | import argparse |
| 4 | import sys |
| 5 | from typing import IO |
| 6 | |
| 7 | |
| 8 | def cat_to_stream(path: str, buffer: IO[bytes]) -> None: |
| 9 | with open(path, "rb") as infile: |
| 10 | buffer.write(infile.read()) |
| 11 | |
| 12 | |
| 13 | if __name__ == "__main__": |
| 14 | parser = argparse.ArgumentParser(description="Cat to stderr") |
| 15 | parser.add_argument("path", help="Path to the file to be catted") |
| 16 | args = parser.parse_args() |
| 17 | cat_to_stream(args.path, sys.stderr.buffer) |