Home » Console » Console_CommandLine
A full featured command line options and arguments parser
This package is unmaintained.
Download latest release 1.2.2 (there is a newer Composer installable version)
License: MIT
Description
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...
Documentation
Maintainers
- David JEAN LOUIS (izi) — lead, active
- Richard Quadling (rquadling) — lead, active
Dependencies
Required
- PHP (>= 5.3.0)
- PEAR Installer (>= 1.4.0b1)
- dom (extension)
- xml (extension)
Releases
- 1.2.2 (stable, 2016-07-14)
Release notes
License: MIT
* Fix bug #21063: xmlschema.rng location does not work with composer [alec]
- 1.2.1 (stable, 2015-12-10)
Release notes
License: 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 - 1.2.0 (stable, 2012-10-25)
Release notes
License: 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] - 1.1.3 (stable, 2010-04-10)
Release notes
License: MIT
* fixed package.xml to allow installation via pyrus.
- 1.1.2 (stable, 2010-04-10)
Release notes
License: 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. - 1.1.1 (stable, 2009-11-11)
Release notes
License: 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 - 1.1.0 (stable, 2009-06-19)
Release notes
License: 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) - 1.0.6 (stable, 2008-12-26)
Release notes
License: 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. - 1.0.5 (stable, 2008-12-06)
Release notes
License: 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. - 1.0.4 (stable, 2008-10-09)
Release notes
License: 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. - 1.0.3 (stable, 2008-09-30)
Release notes
License: 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. - 1.0.2 (stable, 2008-08-22)
Release notes
License: 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). - 1.0.1 (stable, 2008-08-01)
Release notes
License: 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. - 1.0.0 (stable, 2008-05-22)
Release notes
License: 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. - 1.0.0RC3 (beta, 2008-03-12)
Release notes
License: 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). - 1.0.0RC2 (beta, 2008-02-23)
Release notes
License: 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). - 1.0.0RC1 (beta, 2008-01-18)
Release notes
License: 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. - 0.2.1 (beta, 2008-01-09)
Release notes
License: MIT License
fixed bug #12859: xmlschema.rng gets searched at the wrong folder
- 0.2.0 (beta, 2007-12-31)
Release notes
License: 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. - 0.1.1 (alpha, 2007-12-21)
Release notes
License: 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. - 0.1.0 (alpha, 2007-12-17)
Release notes
License: MIT License
Initial release.
Bugs
| ID | Status | Type | Version | Date | Summary |
|---|---|---|---|---|---|
| #12711 | Closed | Bug | 0.1.0 | 2007-12-17 | Subcommand support not working. |
| #12850 | Bogus | Bug | 0.2.0 | 2008-01-08 | Long names incorrectly parsed |
| #12859 | Closed | Bug | 0.2.0 | 2008-01-08 | xmlschema.rng gets searched at the wrong folder |
| #13038 | Closed | Req | 1.0.0RC1 | 2008-02-01 | Remove dependency on $_SERVER |
| #13132 | Closed | Bug | 1.0.0RC1 | 2008-02-16 | <choices> within <option> using XML does not appear to be supported yet. |
| #14142 | Closed | Bug | 1.0.0 | 2008-06-15 | Missing ext for include file and more |
| #14435 | Closed | Bug | 1.0.0 | 2008-08-01 | own -h short option doesn't remove help short option |
| #14436 | Closed | Bug | 1.0.0 | 2008-08-01 | Typo in error message |
| #14454 | Closed | Bug | 1.0.1 | 2008-08-04 | Console_Commandline hangs when called via browser |
| #14717 | Closed | Bug | 1.0.2 | 2008-09-27 | Password not option with XML config |
| #14753 | Closed | Req | 1.0.3 | 2008-10-06 | add_list_option parameter for --list-XXX options |
| #14762 | Closed | Bug | 1.0.3 | 2008-10-08 | error message always tells me to use "-h" for help |
| #15251 | Closed | Req | CVS | 2008-12-05 | Allow specifying optional arguments for sub-commands |
| #15324 | Closed | Req | CVS | 2008-12-16 | Add ability to set custom error messages |
| #15325 | Closed | Req | CVS | 2008-12-16 | Add ability to detect missing sub-command |
| #15374 | Closed | Bug | CVS | 2008-12-22 | RelaxNG validation should be less strict |
| #15375 | Closed | Bug | CVS | 2008-12-22 | Cannot add a comment before the root node of the xml file |
| #15376 | Closed | Bug | CVS | 2008-12-22 | short option and long options in separated lines in help message |
| #15377 | Closed | Bug | CVS | 2008-12-22 | StoreFalse and StoreTrue actions should have a boolean default value |
| #15407 | Closed | Bug | CVS | 2008-12-26 | Broken CVS unit tests |
| #15918 | Closed | Req | 2009-02-20 | More flexible list action | |
| #15919 | Duplicate | Req | 2009-02-20 | More flexible list action | |
| #16317 | Closed | Doc | CVS | 2009-06-11 | Using Console_CommandLine with web requests is not documented |
| #16320 | Closed | Bug | 1.0.6 | 2009-06-12 | StoreArray/Default/Choices conflict |
| #16329 | Closed | Bug | 1.0.6 | 2009-06-15 | sub command aliases do not work. |
| #16330 | Closed | Bug | 1.0.6 | 2009-06-15 | Nested subCommands help output not quite right. |
| #16331 | Wont fix | Req | 1.0.6 | 2009-06-15 | Using out of order options should not be an issue. |
| #16332 | Closed | Req | CVS | 2009-06-16 | Add support for optional arguments in XML |
| #16370 | Closed | Req | 1.1.0 | 2009-06-23 | Allow pre-processing of arguments for lists. |
| #16497 | Closed | Req | 1.1.0 | 2009-08-07 | Cascade line width when using commands. |
| #16507 | Closed | Doc | 1.1.0 | 2009-08-10 | Typo in code example |
| #16679 | Wont fix | Req | 1.1.0 | 2009-10-05 | Allow arguments to have Actions |
| #16680 | Duplicate | Req | 1.1.0 | 2009-10-05 | Allow arguments to have Actions |
| #16764 | Closed | Bug | 1.1.0 | 2009-11-04 | Invalid Package.xml |
| #16848 | Closed | Bug | 1.1.1 | 2009-11-30 | Trailing spaces in quoted argument are truncated. |
| #16849 | Closed | Bug | 1.1.1 | 2009-11-30 | WebResquest test3 is using POST and not GET to supply data. |
| #16850 | Closed | Bug | 1.1.1 | 2009-11-30 | Parse9 test (password) fails. |
| #16887 | Closed | Doc | 2009-12-08 | User note that is a documentation problem | |
| #16914 | Closed | Bug | CVS | 2009-12-17 | Password action doesn't work as expected |
| #17113 | Bogus | Bug | CVS | 2010-02-16 | Tests fail |
| #17470 | Bogus | Bug | SVN | 2010-06-06 | Trunk unit test failures |
| #18008 | Closed | Req | 1.1.3 | 2010-10-29 | support "list" arguments like list options |
| #18170 | No Feedback | Req | 1.1.3 | 2011-01-03 | Allow several options to work with the same name |
| #18397 | Closed | Doc | 1.1.3 | 2011-03-24 | List action example is wrong |
| #18582 | Closed | Req | 1.1.3 | 2011-06-03 | Add possibility to require a subcommand |
| #18583 | Closed | Req | 1.1.3 | 2011-06-03 | Default values for arguments |
| #18584 | Closed | Bug | 1.1.3 | 2011-06-03 | Optional arguments not shown as optional |
| #18682 | Closed | Bug | SVN | 2011-07-24 | columnWrap() in Default Renderer eats up lines with only a EOL |
| #18703 | Closed | Req | 1.1.3 | 2011-08-03 | No way to override reading of stdin with - |
| #18958 | Closed | Bug | SVN | 2011-11-06 | Test failure |
| #18988 | Closed | Bug | SVN | 2011-11-14 | remove error_reporting (for PEAR QA team) |
| #19106 | Closed | Bug | SVN | 2011-12-07 | upgrade PHPUnit require statements (for PEAR QA Team) |
| #19163 | Wont fix | Req | 1.1.3 | 2011-12-29 | Support for multiple options like "-Dfoo=bar" |
| #19683 | Closed | Bug | 1.2.0 | 2012-10-30 | Unit tests are broken |
| #19921 | Closed | Bug | 1.2.0 | 2013-04-29 | package dependencies don't include dom |
| #19945 | Wont fix | Req | 1.2.0 | 2013-05-12 | support a max number of arguments |
| #20963 | Closed | Bug | 1.2.0 | 2015-10-12 | Release not published on packagist |
| #20964 | Closed | Req | 1.2.0 | 2015-10-14 | Update composer deps |
| #21063 | Closed | Bug | 1.2.1 | 2016-05-12 | xmlschema.rng location does not work with composer |
| #21223 | Bogus | Bug | 1.2.2 | 2017-06-27 | Short option with value not detected on PHP 7.1 |