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

Bug #16330 Nested subCommands help output not quite right.
Submitted: 2009-06-15 20:21 UTC
From: rquadling Assigned: izi
Status: Closed Package: Console_CommandLine (version 1.0.6)
PHP Version: 5_3 CVS-2009-06-15 OS: Windows XP SP3
Roadmaps: (Not assigned)    
Subscription  


 [2009-06-15 20:21 UTC] rquadling (Richard Quadling)
Description: ------------ With nested subCommands, the help output is not quite right. Run the test script as ... test.php -h test.php update -h test.php update downgrade -h Essentially 2 issues. 1 - The script path is in the wrong place. 2 - The [args] text is not always present. Test script: --------------- <?php require_once 'Console/CommandLine.php'; $o_Parser = new Console_CommandLine(); $o_Command = $o_Parser->addCommand ( 'update', array ( 'description' => 'Update the given package', ) ); $o_Command->addCommand ( 'downgrade', array ( 'description' => 'Downgrade the given package', ) ); print_r($o_Parser->parse()); Expected result: ---------------- Usage: Z:\test.php [options] [args] Z:\test.php [options] <command> [options] [args] Options: -h, --help show this help message and exit Commands: update Update the given package Update the given package Usage: Z:\test.php [options] update [options] [args] Z:\test.php [options] update [options] <command> [options] [args] Options: -h, --help show this help message and exit Commands: downgrade Downgrade the given package Downgrade the given package Usage: Z:\test.php [options] update [options] downgrade [options] [args] Options: -h, --help show this help message and exit Actual result: -------------- Usage: Z:\test.php [options] Z:\test.php [options] <command> [options] [args] Options: -h, --help show this help message and exit Commands: update Update the given package Update the given package Usage: Z:\test.php [options] update [options] Z:\test.php [options] update [options] <command> [options] [args] Options: -h, --help show this help message and exit Commands: downgrade Downgrade the given package Downgrade the given package Usage: update [options] Z:\test.php [options] downgrade [options] Options: -h, --help show this help message and exit

Comments

 [2009-06-15 21:32 UTC] izi (David Jean Louis)
>> 1 - The script path is in the wrong place. it seems that's a bug, I'll look at it. >> 2. The [args] text is not always present. I don't fully understand the problem, could you please send me the whole script, because in you're example, you don't have any args for the main parser, so it's normal that the [args] text is not displayed in the help message.
 [2009-06-15 21:33 UTC] izi (David Jean Louis)
-Status: Open +Status: Assigned -Assigned To: +Assigned To: izi
 [2009-06-16 02:33 UTC] rquadling (Richard Quadling)
I didn't know [args] wasn't displayed. The script I've supplied DOES show [args] in some instances, even though I've not supplied any. The issue comes from showing help with sub-sub-commands. Maybe, limiting subcommands to 1 level.
 [2009-06-16 02:48 UTC] izi (David Jean Louis)
>> I didn't know [args] wasn't displayed. The script I've supplied >> DOES show [args] in some instances, even though I've not >> supplied any. You're right, that's a bug, it should display [args] in the sub-command only if args were supplied, I'll look at this too. Thanks for the report.
 [2009-06-16 14:13 UTC] izi (David Jean Louis)
-Status: Assigned +Status: Closed
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.