Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

Version 2.0.1 *(2015-09-15)*
----------------------------
* New: Fix colors on Windows. Use options `-f` / `--force-windows-colors` to force conversion
in case a terminal appears to be a tty. Requires module `colorama`

Version 2.0.0 *(2015-05-25)*
----------------------------

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ Make sure that `adb` from the [Android SDK][3] is on your PATH. This script will
not work unless this is that case. That means, when you type `adb` and press
enter into your terminal something actually happens.

On Windows, you can do `pip install colorama` if you see weird arrows instead of
colors. In case that does not help, try using option `-f`.

To include `adb` and other android tools on your path:

export PATH=$PATH:<path to Android SDK>/platform-tools
Expand Down
10 changes: 9 additions & 1 deletion pidcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import subprocess
from subprocess import PIPE

__version__ = '2.0.0'
__version__ = '2.0.1'

LOG_LEVELS = 'VDIWEF'
LOG_LEVELS_MAP = dict([(LOG_LEVELS[i], i) for i in range(len(LOG_LEVELS))])
Expand All @@ -46,6 +46,7 @@
parser.add_argument('-i', '--ignore-tag', dest='ignored_tag', action='append', help='Filter output by ignoring specified tag(s)')
parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + __version__, help='Print the version number and exit')
parser.add_argument('-a', '--all', dest='all', action='store_true', default=False, help='Print all log messages')
parser.add_argument('-f', '--force-windows-colors', dest='force_windows_colors', action='store_true', default=False, help='Force converting colors to Windows format')

args = parser.parse_args()
min_level = LOG_LEVELS_MAP[args.min_level.upper()]
Expand Down Expand Up @@ -86,6 +87,13 @@
except:
pass

try:
import colorama
colorama.init(convert=args.force_windows_colors)
except ImportError:
if args.force_windows_colors:
raise

BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)

RESET = '\033[0m'
Expand Down