Skip to content

Commit 37a5321

Browse files
author
Martin Breuer
committed
Integrated PR JakeWharton#108 from the original project (using colorama)
Thanks to oakkitten
1 parent e11403c commit 37a5321

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pidcat.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + __version__, help='Print the version number and exit')
4848
parser.add_argument('-a', '--all', dest='all', action='store_true', default=False, help='Print all log messages')
4949
parser.add_argument('--timestamp', dest='add_timestamp', action='store_true', help='Prepend each line of output with the current time.')
50+
parser.add_argument('-f', '--force-windows-colors', dest='force_windows_colors', action='store_true', default=False, help='Force converting colors to Windows format')
5051

5152
args = parser.parse_args()
5253
min_level = LOG_LEVELS_MAP[args.min_level.upper()]
@@ -89,6 +90,13 @@
8990
except:
9091
pass
9192

93+
try:
94+
import colorama
95+
colorama.init(convert=args.force_windows_colors)
96+
except ImportError:
97+
if args.force_windows_colors:
98+
raise
99+
92100
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
93101

94102
RESET = '\033[0m'

0 commit comments

Comments
 (0)