Console_CommandLine
pear.php.net
A full featured command line options and arguments parser
Console_CommandLine is a full featured package for managing command-line options and arguments highly inspired from python optparse module, it allows the developer to easily build complex command line interfaces.

Main features: * handles sub commands (ie. $ myscript.php -q subcommand -f file), * can be completely built from an xml definition file, * generate --help and --version options automatically, * can be completely customized, * builtin support for i18n, * and much more...
David JEAN LOUIS
izi
izimobil@gmail.com yes
Richard Quadling
rquadling
rquadling@gmail.com yes
2015-12-10
19:54:31
1.2.1
1.2.1
stable
stable
MIT
* Fixed bug #18397: List action example is wrong [cweiske] * Fixed bug #18682: columnWrap() in refault renderer eats up lines with only a EOL [izi, thanks Helgi] * Fixed bug #18703: No way to override reading of stdin with - [izi, thanks Gwynne Raskind] * Fixed bug #19683: Unit tests are broken [farell] * Fixed bug #19921: package dependencies don't include dom [cweiske] * Fixed unit tests [izi] * Fixed comparison on PHP 7 [Jan Olsen] * Allow multiple instances of the parser by making static variables private [Greg Oriol] * Add composer support
5.1.0
1.4.0b1
dom
xml
2007-12-19
0.1.0
0.1.0
alpha
alpha
MIT License
Initial release.
2007-12-21
0.1.1
0.1.1
alpha
alpha
MIT License
* bugs - fixed bug #12711, - fixed wrong error triggered when argument name is invalid.

* changes - some cosmetic changes, - added a lot of phpt test files.
2008-01-09
0.2.0
0.2.0
beta
beta
MIT License
- fixed a bug in Option::toString() (values were not displayed for short options), - fixed a parsing bug: if "-" is passed on the command line it should be treated as an argument, - stop option parsing when a "--" is found as gnu getopt does, - added a "force_posix" boolean attribute that tells the parser to be POSIX compliant, POSIX demands the following behavior: the first non-option stops option processing, - added more regression tests.
2008-01-09
0.2.1
0.2.1
beta
beta
MIT License
fixed bug #12859: xmlschema.rng gets searched at the wrong folder
2008-01-18
1.0.0RC1
1.0.0RC1
beta
beta
MIT License
- fixed a missing check when a short option require an argument and is the last in the argv array, - more GNU getopt compliance: long option/argument can also be separated by a space now and long options abbreviations are supported, - added a "Password" action: with this action it is possible to specify a password on the command line, and if it is missing it will be prompted to user (and will not be echo on stdin on UNIX systems), - allow "force_posix" option to be passed to the constructor, - added more tests.
2008-03-10
1.0.0RC2
1.0.0RC2
beta
beta
MIT License
- allow "force_posix" option to be passed to the constructor; - fixed bug #13038 changed the signature of the parse method to allow the developer to pass argc and argv array (instead of using $_SERVER values); - fixed bug #13132 : "choices" not supported in xml definition (also added "force_posix" attribute support in xml).
2008-03-12
1.0.0RC3
1.0.0RC3
beta
beta
MIT
- fixed a strict standards notice: Console_CommandLine_Exception::build() should be static; - changed behaviour when a StoreArray option is positioned at the end; - now use pfm (so removed package.php and package2.xml).
2008-03-12
1.0.0RC3
1.0.0RC3
beta
beta
MIT
- fixed a strict standards notice: Console_CommandLine_Exception::build() should be static; - changed behaviour when a StoreArray option is positioned at the end; - now use pfm (so removed package.php and package2.xml).
2008-05-22
1.0.0
1.0.0
stable
stable
MIT
- doc is now in peardoc format (thanks to cweiske for his precious help); - better handling of custom instances (added an accept() method); - added an AllTests.php file to make phpunit happy; - added tests for xml usage; - some cosmetic changes.
2008-08-01
1.0.1
1.0.1
stable
stable
MIT
- Better code coverage of tests (nearly 100%); - fixed two bad include_once; - fixed bug #14435 (own -h short option doesn't remove help short option) and did the same for "version" option; - fixed bug #14436 (Typo in error message) and some fixed other typos.
2008-08-22
1.0.2
1.0.2
stable
stable
MIT
- fixed bug #14454 (Console_Commandline hangs when called via browser); - fixed outputter bug (STDOUT/STDERR not defined with php-cgi); - Console_CommandLine can now handle web requests (it convert automatically a request to options/arguments).
2008-09-30
1.0.3
1.0.3
stable
stable
MIT
- now handles stdin with the "-" special switch; - fixed bug #14717 (Password not optional when parser built from an xml file); - added relevant unit tests; - removed useless require_once's in some tests.
2008-10-09
1.0.4
1.0.4
stable
stable
MIT
- implemented feature request #14753 (add_list_option parameter for --list-XXX option); - fixed bug #14762 (error message always tells me to use "-h" for help); - added relevant unit tests; - cleaned up phpdoc tags and some cosmetic changes.
2008-12-06
1.0.5
1.0.5
stable
stable
MIT
* implemented feature request #15251: Allow specifying optional arguments for sub-commands, * use "name" instead of "help_name" when generating list-xxx options, * updated relevant unit tests, * added examples for sub-commands usage.
2008-12-26
1.0.6
1.0.6
stable
stable
MIT
Bugfix release: * fixed bug #15374 (RelaxNG validation should be less strict); * fixed bug #15375 (Cannot add a comment before the root node of the xml file); * fixed bug #15376 (short option and long options in separated lines in help); * fixed bug #15377 (StoreFalse/True actions should have a boolean default value); * added relevant unit tests.
2009-06-19
1.1.0
1.1.0
stable
stable
MIT
* changed sources layout to make easier to use / run tests without installing the package with pear * implemented subcommand aliases (as requested by Greg for pyrus) * implemented request #15325: add ability to detect missing sub-command (patch by gauthierm, thanks) * implemented request #15324: add ability to set custom error messages (patch by gauthierm, thanks) * fixed bug #16320: storeArray default value not cleared when options arguments given (patch by Richard Quadling, thanks!) * fixed bug #16329: sub command aliases do not work (was a "too early documentation" issue) * fixed bug #16330: nested subCommands help output not quite right * implemented request #16332: add support for optional arguments in XML (patch by gauthierm, thanks)
2009-11-11
1.1.1
1.1.1
stable
stable
MIT
Bugfix release: * fixed bug #16507: typo in code example (thanks Richard) * fixed bug #16497: cascade command properties to sub-commands * fixed bug #16370: allow pre-processing of arguments for list (thanks rquadling for the patch) * fixed bug #16764: Invalid Package.xml (thanks mklappstuhl for the patch) * fixed some test cases
2010-04-10
1.1.2
1.1.0
stable
stable
MIT
Bugfix release: * fixed bug #16848: Trailing spaces in quoted argument are truncated, * fixed bug #16849: Replaced $_GET by $_REQUEST to handle POST correctly, * fixed bug #16850: Parse9 test (password) fails (on windows), * fixed bug #16914: Password action now operates as expected when it is the last parameter or the last parameter before a command, * displayUsage() should output to stdout instead of stderr, * added the possibility to pass "false" as exitCode to the display*() methods to prevent exit() calls, * fixed some typos in code comments.
2010-04-10
1.1.3
1.1.0
stable
stable
MIT
* fixed package.xml to allow installation via pyrus.
2012-10-25
1.2.0
1.2.0
stable
stable
MIT
* Implemented feature request #18583 (default values for arguments) [izi] * Implemented feature request #18582 (add possibility to require a subcommand) [izi] * Booleans read from an XML file or string are now case insensitive [rquadling] * Fixed unit tests [CloCkWeRX] * arguments now accept "choices" [izi, thanks Laurent Laville]
2015-12-10
1.2.1
1.2.1
stable
stable
MIT
* Fixed bug #18397: List action example is wrong [cweiske] * Fixed bug #18682: columnWrap() in refault renderer eats up lines with only a EOL [izi, thanks Helgi] * Fixed bug #18703: No way to override reading of stdin with - [izi, thanks Gwynne Raskind] * Fixed bug #19683: Unit tests are broken [farell] * Fixed bug #19921: package dependencies don't include dom [cweiske] * Fixed unit tests [izi] * Fixed comparison on PHP 7 [Jan Olsen] * Allow multiple instances of the parser by making static variables private [Greg Oriol] * Add composer support