Skip to content

Commit

Permalink
Merge pull request gleitz#96 from Nagasaki45/colorize
Browse files Browse the repository at this point in the history
Colorize output if HOWDOI_COLORIZE environment variable is set
  • Loading branch information
gleitz committed Oct 30, 2014
2 parents 2e9d1ab + 35b3164 commit 12e5116
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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 <http://stackexchange.com/sites?view=list#traffic>`_.
- Setting the HOWDOI_COLORIZE environment variable will colorize the output by default.
- Special thanks to Rich Jones (`@miserlou <https://github.com/miserlou>`_) for the idea.

Development
Expand Down
3 changes: 3 additions & 0 deletions howdoi/howdoi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 12e5116

Please sign in to comment.