From db3a9b672fcb6c43ff07e019875000b87c1231c8 Mon Sep 17 00:00:00 2001 From: Erin O'Connell Date: Tue, 3 Jul 2018 19:43:17 -0700 Subject: [PATCH 1/2] display color when running in CMDER but not regular ol' powershell --- pipenv/patched/crayons.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pipenv/patched/crayons.py b/pipenv/patched/crayons.py index a77886c5..114da100 100644 --- a/pipenv/patched/crayons.py +++ b/pipenv/patched/crayons.py @@ -34,12 +34,14 @@ __all__ = ( COLORS = __all__[:-2] is_ipython = "get_ipython" in dir() +isCmder = True if os.environ.get('CMDER_ROOT') else False + try: is_powershell = "powershell" in shellingham.detect_shell()[0] except shellingham.ShellDetectionFailure: is_powershell = False -if is_ipython or is_powershell: +if is_ipython or (is_powershell and not isCmder): """when ipython is fired lot of variables like _oh, etc are used. There are so many ways to find current python interpreter is ipython. get_ipython is easiest is most appealing for readers to understand. From e037967da4c30d3dd12869ca51b07136cab3c2fd Mon Sep 17 00:00:00 2001 From: Erin O'Connell Date: Tue, 3 Jul 2018 20:08:40 -0700 Subject: [PATCH 2/2] crayons will now check to see if powershell is running in CMDER, Hyper, or VSCode and enable colors if it is! --- pipenv/patched/crayons.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pipenv/patched/crayons.py b/pipenv/patched/crayons.py index 114da100..bb4b3d97 100644 --- a/pipenv/patched/crayons.py +++ b/pipenv/patched/crayons.py @@ -34,14 +34,22 @@ __all__ = ( COLORS = __all__[:-2] is_ipython = "get_ipython" in dir() -isCmder = True if os.environ.get('CMDER_ROOT') else False + +if ( + os.environ.get("CMDER_ROOT") + or os.environ.get("VSCODE_PID") + or os.environ.get("TERM_PROGRAM") == "Hyper" +): + is_native_powershell = False +else: + is_native_powershell = True try: is_powershell = "powershell" in shellingham.detect_shell()[0] except shellingham.ShellDetectionFailure: is_powershell = False -if is_ipython or (is_powershell and not isCmder): +if is_ipython or (is_powershell and is_native_powershell): """when ipython is fired lot of variables like _oh, etc are used. There are so many ways to find current python interpreter is ipython. get_ipython is easiest is most appealing for readers to understand.