summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorDaniel Ahn <sangbumahn@gmail.com>2019-06-24 19:54:58 -0700
committerDaniel Ahn <sangbumahn@gmail.com>2019-06-24 19:54:58 -0700
commit2461740fc18e9d7fd0eb7aab20fcc168d2318dd0 (patch)
tree9dc478a4bb623ad280b467cba3b9cd01a48e851b /cmd2/utils.py
parente8206628eefe8234cb5118807c6f40e983c2a316 (diff)
downloadcmd2-git-2461740fc18e9d7fd0eb7aab20fcc168d2318dd0.tar.gz
Fix flake8 errors, don't use Style.RESET, fix docstring, change some pexcept() calls to perror()
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
index 641489f2..791daba9 100644
--- a/cmd2/utils.py
+++ b/cmd2/utils.py
@@ -12,7 +12,6 @@ import threading
import unicodedata
from typing import Any, Iterable, List, Optional, TextIO, Union
-from colorama import Style
from wcwidth import wcswidth
from . import constants
@@ -60,7 +59,10 @@ def style_message(msg: Any, end: str = '\n', fg: str = '', bg: str = '') -> str:
except KeyError:
raise ValueError('Color {} does not exist.'.format(bg))
values.append(msg)
- values.append(Style.RESET_ALL)
+ if fg:
+ values.append(constants.FG_COLORS['reset'])
+ if bg:
+ values.append(constants.BG_COLORS['reset'])
values.append(end)
return "".join(values)