Skip to content
Myr

flush when calling `clear`, use colorama on Windows (#2286)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents dcdca58, 8924144 · Browse files · 2 files+4 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−6 removed

  • other:+4 added−6 removed

2 files+4 added−6 removed

modified:src/click/termui.py+3 added-6 removed
1import inspect2import io3import itertools4import os4import sys5import typing as t6from gettext import gettext as _78from ._compat import isatty9from ._compat import strip_ansi11from ._compat import WIN10from .exceptions import Abort11from .exceptions import UsageError12from .globals import resolve_color_default13from .types import Choice
426 unmodified lines
440 .. versionadded:: 2.0441 """442 if not isatty(sys.stdout):443 return446 if WIN:447 os.system("cls")448 else:449 sys.stdout.write("\033[2J\033[1;1H")444445 # ANSI escape \033[2J clears the screen, \033[1;1H moves the cursor446 echo("\033[2J\033[1;1H", nl=False)447448449def _interpret_color(450 color: t.Union[int, t.Tuple[int, int, int], str], offset: int = 0451) -> str:452 if isinstance(color, int):
332 unmodified lines
modified:CHANGES.rst+1 added
12 unmodified lines
13 function. :pr:`2421`14- Bash version detection doesn't fail on Windows. :issue:`2461`15- Completion works if there is a dot (``.``) in the program name. :issue:`2166`16- Improve type annotations for pyright type checker. :issue:`2268`17- Improve responsiveness of ``click.clear()``. :issue:`2284`181920Version 8.1.321-------------
1040 unmodified lines