Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.0

Request #8771 improve help-usage output render with optional indentation
Submitted: 2006-09-23 09:38 UTC
From: farell Assigned: scottmattocks
Status: Closed Package: Console_Getargs (version 1.3.1)
PHP Version: 4.4.2 OS: windows xp
Roadmaps: (Not assigned)    
Subscription  


 [2006-09-23 09:38 UTC] farell (Laurent Laville)
Description: ------------ getHelp() method produces a render that can be easily improved as standard help-usage (see php cli for example; switch parameters are tab indented). add a new optional parameter $margin with default value zero function getHelp($config, $helpHeader = null, $helpFooter = '', $maxlength = 78, $margin = 0) and replace line 313 $col1[$i] = !empty($shortArr) ? '-'.$shortArr[0].' ' : ''; by $col1[$i] = str_repeat(' ', $margin); $col1[$i] .= !empty($shortArr) ? '-'.$shortArr[0].' ' : ''; Example below are part of the new version (rewrite) PHP_CompatInfo CLI (under development) Laurent Test script: --------------- <?php // something like : $header = 'Usage: ' . basename($_SERVER['SCRIPT_NAME']) . " [options]\n\n"; $footer = ''; echo Console_Getargs::getHelp($opts, $header, $footer, 78, 4)."\n"; ?> Expected result: ---------------- Usage: pcicmd.php [options] -d --dir=<value> Parse DIR to get its compatibility info -f --file=<value> Parse FILE to get its compatibility info Actual result: -------------- Usage: pcicmd.php [options] -d --dir=<value> Parse DIR to get its compatibility info -f --file=<value> Parse FILE to get its compatibility info

Comments

 [2006-10-03 19:11 UTC] scottmattocks (Scott Mattocks)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Console_Getargs