Re: Console_CommandLine problem?
| From: | David Jean Louis | Date: | Sun, 27 Jan 2008 09:47:00 +0000 |
| Subject: | Re: Console_CommandLine problem? | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28472@lists.php.net to get a copy of this message | ||
Jake,
Thanks for everything, that solves my problem :) Is there a way to configure the line width to go to the end of the console then wrap instead having a fixed line width? And lastly is there a way to put some spacing between each help option so that there is probably a new line between each option?Console_CommandLine is completely customizable, so yes, this is possible. For example you could override the default renderer like this: <?php require_once 'Console/CommandLine.php'; require_once 'Console/CommandLine/Renderer/Default.php'; class CustomRenderer extends Console_CommandLine_Renderer_Default {
/**
* We override the columnWrap method, to just return the line
* unwrapped and with a newline at the end.
*/
function columnWrap($text, $cw) {
return $text . "\n";
}
}
$parser = new Console_CommandLine();
$renderer = new CustomRenderer($parser);
$parser->renderer = $renderer;
// usual code here...
?>
David.