Active
Project:
Drupal Terminal
Version:
6.x-1.x-dev
Component:
User interface
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Feb 2010 at 23:53 UTC
Updated:
9 Feb 2010 at 23:53 UTC
drush outputs some ANSI color codes which look ugly.
It can be supported by patching drush_terminal.terminal.inc below:
...
$output = implode("\n", $output);
// Ugly hack to process the color codes
// We need something like Perl's HTML::FromANSI
// http://search.cpan.org/perldoc?HTML%3A%3AFromANSI
// but for PHP
// http://ansilove.sourceforge.net/ only converts to image :(
// Technique below is from:
// http://stackoverflow.com/questions/1375683/converting-ansi-escape-sequences-to-html-using-php/2233231
$output = preg_replace("/\x1B\[31;40m(.*?)(\x1B\[0m)/", '<span style="color: red">$1</span>$2', $output);
$output = preg_replace("/\x1B\[1m(.*?)(\x1B\[0m)/", '<b>$1</b>$2', $output);
$output = preg_replace("/\x1B\[0m/", '', $output);
echo $output;
...
jquery.terminal.js will also have to be patched:
...
var terminal_append = function(data) {
var formattedData = $('' + data + '');
var dataRows = formattedData.html().split(/\n/);
...
However this means all output must be HTML-safe.
Needs some more work to make the HTML escaping conditional.
A quicker workaround is to disable drush colors altogether (--nocolor).