shaneharter / PHP-Daemon

Build production-ready Daemons using PHP 5.3+. Build fault-tolerant applications without the boilerplate.
Other
768 stars 166 forks source link

Make it easier for developers to add their own Help documentation #12

Open shaneharter opened 12 years ago

shaneharter commented 12 years ago

Refactor the Core_Daemon::show_help() method to work like show_install_instructions().

Create two instance vars on Core_Daemon:

protected $help_usage = array();
protected $help_options = array();

Change the Core_Daemon::getopt() method to write to these arrays. Change the show_help() method to just implode these arrays and print them with a similar format to the existing code.

This will enable application developers to parse their own command line options by overloading getopt (and calling parent::getopt() when they're done), while writing help instructions that get displayed alongside the library-specific instructions.