(bug 31313) Clarify watchlist preference messages
[lhc/web/wiklou.git] / maintenance / term / MWTerm.php
1 <?php
2
3 /**
4 * @ingroup Testing
5 *
6 * Set of classes to help with test output and such. Right now pretty specific
7 * to the parser tests but could be more useful one day :)
8 *
9 * @todo Fixme: Make this more generic
10 */
11
12 class AnsiTermColorer {
13 function __construct() {
14 }
15
16 /**
17 * Return ANSI terminal escape code for changing text attribs/color
18 *
19 * @param $color String: semicolon-separated list of attribute/color codes
20 * @return String
21 */
22 public function color( $color ) {
23 global $wgCommandLineDarkBg;
24
25 $light = $wgCommandLineDarkBg ? "1;" : "0;";
26
27 return "\x1b[{$light}{$color}m";
28 }
29
30 /**
31 * Return ANSI terminal escape code for restoring default text attributes
32 *
33 * @return String
34 */
35 public function reset() {
36 return $this->color( 0 );
37 }
38 }
39
40 /* A colour-less terminal */
41 class DummyTermColorer {
42 public function color( $color ) {
43 return '';
44 }
45
46 public function reset() {
47 return '';
48 }
49 }
50