cvs: php4 /pear/PEAR/Command Common.php
| From: | Stig Bakken | Date: | Tue, 14 May 2002 01:48:20 +0000 |
| Subject: | cvs: php4 /pear/PEAR/Command Common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-3815@lists.php.net to get a copy of this message | ||
ssb Mon May 13 21:48:20 2002 EDT
Modified files:
/php4/pear/PEAR/Command Common.php
Log:
* moved get{Help,Commands,Options} here
Index: php4/pear/PEAR/Command/Common.php
diff -u php4/pear/PEAR/Command/Common.php:1.10 php4/pear/PEAR/Command/Common.php:1.11
--- php4/pear/PEAR/Command/Common.php:1.10 Sun May 12 17:09:04 2002
+++ php4/pear/PEAR/Command/Common.php Mon May 13 21:48:20 2002
@@ -16,7 +16,7 @@
// | Author: Stig Sæther Bakken <ssb@fast.no> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.10 2002/05/12 21:09:04 ssb Exp $
+// $Id: Common.php,v 1.11 2002/05/14 01:48:20 ssb Exp $
require_once "PEAR.php";
@@ -55,11 +55,28 @@
// }}}
- // {{{ 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'];
}
// }}}
@@ -91,6 +108,15 @@
}
$long_args[] = $option . $larg;
}
+ }
+
+ // }}}
+ // {{{ getHelp()
+
+ function getHelp($command)
+ {
+ $help = preg_replace('/{config\s+([^\}]+)}/e',
"\$config->get('\1')", @$this->commands[$command]['doc']);
+ return $help;
}
// }}}