wtee
wtee copied to clipboard
Support for ANSI escape sequences
Many applications use ANSI escape codes extensively for styling text in output. Currently Wtee is not aware of escape codes and prints them as is, which makes logs in some cases look like this: [0m[1;31madmin[0m[1m@[0m[0m[1;31madmin[0m.
This pull request adds two options:
- Don't show escape sequences in log view.
Hides anything that matches
\x1b\[[0-9;]*[a-zA-Z] - Enable colors in output. Interprets Select Graphic Rendition for text styling: 1 - lighter than normal 2 - darker than normal 3 - italic 4 - underline 5 - blinking (fast blinking (6) has no effect, as in GNOME Terminal) 7 - reverse 8 - hide 9 - cross-out Only 3/4 bit type of color sequence is supported: 30-37 - foreground colors (black, red, green, yellow, blue, purple, cyan, white) 40-47 - background colors. The color scheme is similar to Tango of GNOME Terminal.
Both options are enabled by default.
Thanks - this looks great. I'll try having a closer look during the week :+1:
One thing - can you drop the commit with the frontend dependencies? I don't really need them under version control as long as they can be reproduced during the frontend-build step.
Commit 81f1fb5 also adds .bowerrc file:
{
"directory": "wtee/assets/vendor"
}
That way bower install saves dependencies directly to wtee/assets/vendor, not bower_components.
I've cleaned up first 3 commits. "Install frontend dependencies" is dropped, "Don't show ANSI escape codes" is also dropped because changes in this commit are not present in final file, following frontend compilation is also dropped. I also edited eaf147b because I accidentally removed lines:
// TODO: Need a css only solution.
if (line === '') {
line = '‌';
}
It all should be hunky-dory now.
.bowerrc file clearly does not belong to this pull request, but I suggest to add it in some commit later.
Haven't seen any continuation of this ANSI escape handling pull. Does this mean colorized output if merged? Is there a way I can build your changes myself? When I do a "make", I seem to always get back the original wtee.
I used "pip install wtee" to install the latest version of WTee, how to I get the Ansi Colors to work? :)