diff --git a/pidcat.py b/pidcat.py index b430d6f..2cc0d7c 100755 --- a/pidcat.py +++ b/pidcat.py @@ -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))]) @@ -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('-n', '--no-color', dest='no_color', action='store_true', default=False, help='Do not use colorful output') args = parser.parse_args() min_level = LOG_LEVELS_MAP[args.min_level.upper()] @@ -97,7 +98,10 @@ def termcolor(fg=None, bg=None): return '\033[%sm' % ';'.join(codes) if codes else '' def colorize(message, fg=None, bg=None): - return termcolor(fg, bg) + message + RESET + if args.no_color: + return message + else: + return termcolor(fg, bg) + message + RESET def indent_wrap(message): if width == -1: diff --git a/zsh-completion/_pidcat b/zsh-completion/_pidcat index 731d234..546faa0 100644 --- a/zsh-completion/_pidcat +++ b/zsh-completion/_pidcat @@ -57,6 +57,7 @@ _pidcat() { '-v[Print the version number and exit]' \ '-l[Minimum level to be displayed]: :_pidcat_log_levels' \ '-a[Print all log messages]' \ + '-n[Do not use colorful output]' \ '--color-gc[Color garbage collection]' \ '--always-display-tags[Always display the tag name]' \ '--current[Filter logcat by current running app]' \