Simply print unformatted text. This is the ultimate fallback. Don't close the output stream in this case, since it's coming from elsewhere rather than our internal helpers. The stream is wrapped in :class:`~click.utils.KeepOpenFile` so that, as a borrowed stream, it is not closed by
(
stream: t.TextIO, color: bool | None = None
)
| 635 | |
| 636 | @contextlib.contextmanager |
| 637 | def _nullpager( |
| 638 | stream: t.TextIO, color: bool | None = None |
| 639 | ) -> t.Iterator[tuple[t.TextIO, str, bool]]: |
| 640 | """Simply print unformatted text. This is the ultimate fallback. Don't close the |
| 641 | output stream in this case, since it's coming from elsewhere rather than our |
| 642 | internal helpers. |
| 643 | |
| 644 | The stream is wrapped in :class:`~click.utils.KeepOpenFile` so that, as a |
| 645 | borrowed stream, it is not closed by a ``with`` block. The wrapper that |
| 646 | :func:`get_pager_file` builds around it is detached rather than closed. |
| 647 | """ |
| 648 | encoding = get_best_encoding(stream) |
| 649 | |
| 650 | if color is None: |
| 651 | color = False |
| 652 | |
| 653 | yield KeepOpenFile(stream), encoding, color # type: ignore[misc] |
| 654 | |
| 655 | |
| 656 | class Editor: |
no test coverage detected