cvs: phd / config.php

From: Date: Sat, 17 May 2008 06:24:40 +0000
Subject: cvs: phd / config.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-1631@lists.php.net to get a copy of this message
gwynne Sat May 17 06:24:40 2008 UTC Modified files: /phd config.php Log: experimental color support, because it looks nice when the timestamps can be told from the real meesage http://cvs.php.net/viewvc.cgi/phd/config.php?r1=1.40&r2=1.41&diff_format=u Index: phd/config.php diff -u phd/config.php:1.40 phd/config.php:1.41 --- phd/config.php:1.40 Sat May 3 23:59:38 2008 +++ phd/config.php Sat May 17 06:24:40 2008 @@ -1,5 +1,5 @@ <?php -/* $Id: config.php,v 1.40 2008/05/03 23:59:38 bjori Exp $ */ +/* $Id: config.php,v 1.41 2008/05/17 06:24:40 gwynne Exp $ */ /* {{{ PhD error & message handler */ @@ -84,7 +84,9 @@ case VERBOSE_TOC_WRITING: case VERBOSE_CHUNK_WRITING: case VERBOSE_NOVERSION: - fprintf($OPTIONS["phd_info_output"], "[%s - %s] %s\n", $time, $err[$errno], $msg); + $cl1 = $OPTIONS['color_output'] ? "\033[01;{$OPTIONS['color_output']}m" : ''; + $cr = $OPTIONS['color_output'] ? "\033[m" : ''; + fprintf($OPTIONS["phd_info_output"], "{$cl1}[%s - %s]{$cr} %s\n", $time, $err[$errno], $msg); break; // User triggered errors @@ -152,6 +154,7 @@ ), 'skip_ids' => array( ), + 'color_output' => false, 'output_dir' => '.', 'php_error_output' => STDERR, 'user_error_output' => STDERR, @@ -173,6 +176,7 @@ "skip:" => "s:", // The ID to skip (optionally skipping its children too) "verbose:" => "v", // Adjust the verbosity level "list::" => "l::", // List supported themes/formats + "color::" => "c::", // Use color output if possible "version" => "V", // Print out version information "help" => "h", // Print out help ); @@ -387,6 +391,28 @@ break; /* }}} */ + /* {{{ Color output */ + case "c": + case "color": + if (is_array($v)) { + trigger_error(sprintf("You cannot pass %s more than once", $k), E_USER_ERROR); + } + switch ($v) { + case false: + $OPTIONS["color_output"] = (function_exists('posix_isatty') && posix_isatty($OPTIONS['phd_info_output'])) ? 34 : false; + break; + case "no": + case "false": + case "0": + $OPTIONS["color_output"] = false; + break; + default: + $OPTIONS["color_output"] = (function_exists('posix_isatty') && posix_isatty($OPTIONS['phd_info_output'])) ? $v : false; + break; + } + break; + /* }}} */ + /* {{{ Version info */ case "V": case "version": @@ -419,6 +445,8 @@ --list <formats/themes> Print out the supported formats/themes (default: both) -o <directory> --output <directory> The output directory (default: .) + -c <color> + --color <color> Enable color output when output is to a terminal (default: false) -V --version Print the PhD version information -h

« previous php.doc.cvs (#1631) next »