[PEPr] Comment on Console::Console_GetoptPlus
| From: | Michel Corne | Date: | Fri, 11 Jan 2008 08:52:12 +0000 |
| Subject: | [PEPr] Comment on Console::Console_GetoptPlus | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-48913@lists.php.net to get a copy of this message | ||
Michel Corne (http://pear.php.net/user/mcorne) has commented on the proposal for
Console::Console_GetoptPlus.
Comment:
In reply to Travis' comment, the main differences between GetoptPlus and
Console_CommandLine are the following:
+ GetoptPlus implements getopt(), getopt2(), doGetopt(), readPHPArgv() as
in Console_getopt. It is PHP5 code and it throws Exception instead of using
PEAR_ERROR. This was the main driver for writing this package, in line with
PEAR's guidance to port packages from PHP4 to PHP5.
+ Other packages use Console_getopt or implement very similar built-in
command line parsing mechanisms, they could easily benefit from
GetoptPlus.
+ The getoptplus() enhanced method uses a simple array-based description
of the command to specify option short names, long names, their types and
usage. There is no need to call additional methods.
+ getoptplus() accepts option name shortcuts such as "--f" or "--for" for
"--format". This is similar to other command line parsers and it is nice to
have.
+ GetoptPlus will soon implement a Web interface to run command line
through a browser.
= GetoptPlus and Console_CommandLine can both generate the command usage
automatically.
- GetoptPlus does not handle sub commands nor option value types (or
actions).
As a side note, the package has been on sourceforge for 7 months or so. It
took me that long to propose it to the Pear community: my bad... GetoptPlus
is fully tested and production ready. I am already using it as a built-in
class in other packages. I really would like to use it as a separate
package, hoping it will be accepted. I believe there is room for both
packages as they meet different needs.
Proposal information:
http://pear.php.net/pepr/pepr-proposal-show.php?id=524
--
Sent by PEPr, the automatic proposal system at http://pear.php.net