From b61bd2078549b48c420b43922221394c88097d41 Mon Sep 17 00:00:00 2001 From: Tom Gurion Date: Fri, 19 Sep 2014 12:52:59 +0300 Subject: [PATCH 1/2] Colorize output if HOWDOI_COLORIZE environment variable is set --- howdoi/howdoi.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/howdoi/howdoi.py b/howdoi/howdoi.py index 2af1c55ef..f011bbdd1 100755 --- a/howdoi/howdoi.py +++ b/howdoi/howdoi.py @@ -250,6 +250,9 @@ def command_line_runner(): if not os.getenv('HOWDOI_DISABLE_CACHE'): enable_cache() + if os.getenv('HOWDOI_COLORIZE'): + args['color'] = True + if sys.version < '3': print(howdoi(args).encode('utf-8', 'ignore')) else: From 35b31640c8b38d25c0739de3067a3b76ab61a005 Mon Sep 17 00:00:00 2001 From: Tom Gurion Date: Fri, 19 Sep 2014 17:16:51 +0300 Subject: [PATCH 2/2] Adding a note in the README about HOWDOI_COLORIZE environment variable --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 37b0baf8c..7e5624d97 100644 --- a/README.rst +++ b/README.rst @@ -119,6 +119,7 @@ Notes - An Alfred Workflow for howdoi can be found at `http://blog.gleitzman.com/post/48539944559/howdoi-alfred-even-more-instant-answers `_. - Howdoi uses a cache for faster access to previous questions. Caching functionality can be disabled by setting the HOWDOI_DISABLE_CACHE environment variable. The cache is stored in `~/.cache/howdoi`. - You can set the HOWDOI_URL environment variable to change the source url for answers (default: stackoverflow.com). Other options include `serverfault.com` or `pt.stackoverflow.com`. Here's the `full list `_. +- Setting the HOWDOI_COLORIZE environment variable will colorize the output by default. - Special thanks to Rich Jones (`@miserlou `_) for the idea. Development