Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
Fix #203: support env var DISABLE_PROMPT_COLOR
Browse files Browse the repository at this point in the history
  • Loading branch information
jarun committed Dec 11, 2017
1 parent f4ca2fa commit f2047d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@ Please consult the manual of your terminal emulator as well as the [Wikipedia ar

3. Google News service is not available if the language is `dk` (Denmark), `fi` (Finland) or `is` (Iceland). Use `-l en`. Please refer to #187 for more information.

4. Some users have reported problems with a colored omniprompt (refer to issue [#203](https://github.com/jarun/googler/issues/203)) with iTerm2 on OS X. To force a plain omniprompt:

export DISABLE_PROMPT_COLOR=1

### Notes

1. Initially I raised a pull request but I could see that the last change was made 7 years earlier. In addition, there is no GitHub activity from the original author [Henri Hakkinen](https://github.com/henux) in past year. I have created this independent repo for the project with the name `googler`. I retained the original copyright information.
Expand Down
4 changes: 3 additions & 1 deletion googler
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,8 @@ class GooglerCmd(object):
self._results_filtered = False
self._urltable = {}

self.promptcolor = True if os.getenv('DISABLE_PROMPT_COLOR') is None else False

@property
def options(self):
"""Current options."""
Expand Down Expand Up @@ -1905,7 +1907,7 @@ class GooglerCmd(object):
"""
colors = self.colors
message = 'googler (? for help)'
prompt = (colors.prompt + message + colors.reset + ' ') if colors else (message + ': ')
prompt = (colors.prompt + message + colors.reset + ' ') if (colors and self.promptcolor) else (message + ': ')
enter_count = 0
while True:
try:
Expand Down
3 changes: 3 additions & 0 deletions googler.1
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ Overrides the default browser. Ref:
.BI GOOGLER_COLORS
Refer to the \fBCOLORS\fR section.
.TP
.BI DISABLE_PROMPT_COLOR
Force a plain omniprompt if you are facing issues with colors at the prompt.
.TP
.BI https_proxy
Refer to the \fB--proxy\fR option.
.SH EXAMPLES
Expand Down

0 comments on commit f2047d5

Please sign in to comment.