diff options
Diffstat (limited to 'pyblog')
-rwxr-xr-x | pyblog | 23 |
1 files changed, 3 insertions, 20 deletions
@@ -44,6 +44,8 @@ import toml from rss import * +from utils import utils + ROOTDIR = os.path.dirname(os.path.realpath(__file__)) @@ -96,25 +98,6 @@ WHITE = "" YELLOW = "" RESET = "" -@contextmanager -def init_colorama(): - """Set global foreground modifying ANSI codes. - - BLACK, BLUE, CYAN, GREEN, MAGENTA, RED, WHITE, YELLOW, and RESET. - - """ - - # pylint: disable=exec-used,invalid-name - - colorama.init() - for color, ansi in colorama.Fore.__dict__.items(): - exec("global {0}; {0} = '{1}'".format(color, ansi)) - yield - for color in colorama.Fore.__dict__: - exec("global {0}; {0} = ''".format(color)) - colorama.deinit() - - def current_datetime(): """Return the current datetime, complete with tzinfo. @@ -1723,7 +1706,7 @@ def main(): description="Bring up post selector to select post for editing.") parser_new_post.set_defaults(func=edit_existing_post) - with init_colorama(): + with utils.init_colorama(): args = parser.parse_args() returncode = args.func(args) exit(returncode) |