Proposal for "Console_CommandLine"

» Metadata » Status
» Description

Preliminary note

I am aware of the Console_GetArgs package which is similar to this package, but this package was written because we (in the company I'm working) needed features that were not possible with Console_GetArgs, mainly sub commands and xml definition files. I'll understand if these differences are too small for this package to be included, but I propose the package anyway.

About

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.

Features:

  • handle sub commands (ie. $ myscript.php -q subcommand -f file),
  • handle xml definition files,
  • generate --help and --version options automatically,
  • can be completely customized by overriding the default renderer,
  • and much more...

Project at googlecode

Installation

Just run (with root privileges):

$ pear install http://console-commandline.googlecode.com/files/Console_CommandLine-0.1.0.tgz

And to uninstall:

$ pear uninstall Console_CommandLine-0.1.0

Documentation

A tutorial is coming soon, meanwhile you can browse the API docs and look at the examples files below, they are pretty explanatory.

Examples

» Dependencies » Links
» Timeline » Changelog
  • First Draft: 2007-11-11
  • Proposal: 2007-11-11
  • Call for Votes: 2007-12-03
  • David Jean Louis
    [2007-11-19 11:51 UTC]

    • CS improvements,
    • added Relax NG validation for xml definitions,
    • options action refactoring, each action is now a class, and users can register custom actions,
    • removed the 'render' prefix in Renderer methods,
    • 'Callback' action now use call_user_func(),
    • some code reorganisations / minor fixes
  • David Jean Louis
    [2007-11-20 12:49 UTC]

    Added link to the user manual (work in progress)

  • David Jean Louis
    [2007-11-21 13:48 UTC]

    • big CS improvements after a PHP_CodeSniffer session,
    • output is now handled by an Outputter,
    • renderer refactoring, renamed to Console_CommandLine_Renderer_Default and now uses an interface,
    • added parent abstract class Console_CommandLine_Element to put options and arguments code in common,
    • modified the signature of Console_CommandLine constructor: since name is optional, it's better to put it in the params array.