diff options
author | Daniel Ahn <sangbumahn@gmail.com> | 2019-06-24 19:54:58 -0700 |
---|---|---|
committer | Daniel Ahn <sangbumahn@gmail.com> | 2019-06-24 19:54:58 -0700 |
commit | 2461740fc18e9d7fd0eb7aab20fcc168d2318dd0 (patch) | |
tree | 9dc478a4bb623ad280b467cba3b9cd01a48e851b /cmd2/utils.py | |
parent | e8206628eefe8234cb5118807c6f40e983c2a316 (diff) | |
download | cmd2-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.py | 6 |
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) |