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

Request #15325 Add ability to detect missing sub-command
Submitted: 2008-12-16 21:57 UTC
From: gauthierm Assigned: izi
Status: Closed Package: Console_CommandLine (version CVS)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2008-12-16 21:57 UTC] gauthierm (Michael Gauthier)
Description: ------------ Currently, Console_CommandLine doesn't provide any differentiation between entering no sub-command, or entering an invalid sub-command. I'd like to display help if no sub-command is used and show an error message if an invalid sub-command is used.

Comments

 [2009-06-16 08:27 UTC] gauthierm (Michael Gauthier)
This appears to be working now. The sub-command is not required, and the default case in my break statement catches the no-sub-command case quite nicely. David, did you fix this or make the sub-command optional by default in CVS?
 [2009-06-16 08:29 UTC] gauthierm (Michael Gauthier)
Ah nevermind, I forgot what the bug was reporting exactly. It is still valid as there is no way to distinguish between "sqs" and "sqs asdfadsf" when subcommands are used.
 [2009-06-17 10:00 UTC] gauthierm (Michael Gauthier)
The following patch has been added/updated: Patch Name: invalid-subcommand-detection Revision: 1245214852 URL: http://pear.php.net/bugs/patch-display.php?bug=15325&patch=invalid-subcommand-detection&revision=1245214852&display=1
 [2009-06-17 10:01 UTC] gauthierm (Michael Gauthier)
The attached patch throws an exception using the message provider interface when an argument is provided, no arguments are defined and one or more subcommand is defined.
 [2009-06-17 13:42 UTC] izi (David Jean Louis)
-Status: Open +Status: Closed -Assigned To: +Assigned To: izi
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. Commited, I added a unit test, many thanks mike !