From: Stig Bakken Date: Tue, 14 May 2002 01:48:20 +0000 (+0000) Subject: * moved get{Help,Commands,Options} here X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~58 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1da524b016772fb5f6dc5cd1d1f92e7160ccdc0d;p=php * moved get{Help,Commands,Options} here --- diff --git a/pear/PEAR/Command/Common.php b/pear/PEAR/Command/Common.php index 471930fa67..dc308c6896 100644 --- a/pear/PEAR/Command/Common.php +++ b/pear/PEAR/Command/Common.php @@ -55,11 +55,28 @@ class PEAR_Command_Common extends PEAR // }}} - // {{{ getHelp() + // {{{ getCommands() - function getHelp($command) + /** + * Return a list of all the commands defined by this class. + * @return array list of commands + * @access public + */ + function getCommands() + { + $ret = array(); + foreach (array_keys($this->commands) as $command) { + $ret[$command] = $this->commands[$command]['summary']; + } + return $ret; + } + + // }}} + // {{{ getOptions() + + function getOptions($command) { - return array(null, 'No help avaible yet'); + return @$this->commands[$command]['options']; } // }}} @@ -93,6 +110,15 @@ class PEAR_Command_Common extends PEAR } } + // }}} + // {{{ getHelp() + + function getHelp($command) + { + $help = preg_replace('/{config\s+([^\}]+)}/e', "\$config->get('\1')", @$this->commands[$command]['doc']); + return $help; + } + // }}} // {{{ run()