Write ``msg`` to stderr (if provided) and exit with ``code`` (default 1).
(msg: str | None = None, code: int = 1)
| 12 | |
| 13 | |
| 14 | def cli_error(msg: str | None = None, code: int = 1) -> NoReturn: |
| 15 | """Write ``msg`` to stderr (if provided) and exit with ``code`` (default 1).""" |
| 16 | |
| 17 | if msg: |
| 18 | print(msg, file=sys.stderr) |
| 19 | sys.exit(code) |
| 20 | |
| 21 | |
| 22 | def cli_ok(msg: str | None = None) -> NoReturn: |