From edab1197f36374ce97ed4c0cc38ce92fe81573f2 Mon Sep 17 00:00:00 2001 From: "Tomas V.V.Cox" Date: Mon, 1 Apr 2002 14:32:40 +0000 Subject: [PATCH] Go with the help system --- pear/PEAR/Command.php | 9 +++++++++ pear/PEAR/Command/Common.php | 5 +++++ pear/PEAR/Command/Install.php | 15 ++++++++++++++ pear/PEAR/Command/Package.php | 37 ++++++++++++++++++++++++++++++++++- 4 files changed, 65 insertions(+), 1 deletion(-) diff --git a/pear/PEAR/Command.php b/pear/PEAR/Command.php index 851099e66b..8cd99ef74c 100644 --- a/pear/PEAR/Command.php +++ b/pear/PEAR/Command.php @@ -205,6 +205,15 @@ class PEAR_Command } return $GLOBALS['_PEAR_Command_commandopts']; } + + function getHelp($command) + { + $cmds = PEAR_Command::getCommands(); + if (isset($cmds[$command])) { + return call_user_func(array($cmds[$command], 'getHelp'), $command); + } + return false; + } } ?> \ No newline at end of file diff --git a/pear/PEAR/Command/Common.php b/pear/PEAR/Command/Common.php index 7ea724a999..6b9bc744d8 100644 --- a/pear/PEAR/Command/Common.php +++ b/pear/PEAR/Command/Common.php @@ -54,6 +54,11 @@ class PEAR_Command_Common extends PEAR return array(); } + function getHelp($command) + { + return array(null, 'No help avaible yet'); + } + /** * Return a PEAR_CommandResponse object with parameters * filled in. diff --git a/pear/PEAR/Command/Install.php b/pear/PEAR/Command/Install.php index 7204c309bf..1960bc55c3 100644 --- a/pear/PEAR/Command/Install.php +++ b/pear/PEAR/Command/Install.php @@ -57,6 +57,21 @@ class PEAR_Command_Install extends PEAR_Command_Common return array('install', 'uninstall', 'upgrade'); } + function getHelp($command) + { + switch ($command) { + case 'install': + return array('', + 'Installs a PEAR package created by the "package" command'); + case 'uninstall': + return array('', + 'Uninstalls a previously installed PEAR package'); + case 'upgrade': + return array('', + 'Upgrades a PEAR package installed in the system'); + } + } + // }}} // {{{ run() diff --git a/pear/PEAR/Command/Package.php b/pear/PEAR/Command/Package.php index a95f45a1fd..84be4056c4 100644 --- a/pear/PEAR/Command/Package.php +++ b/pear/PEAR/Command/Package.php @@ -1,4 +1,22 @@ | +// +----------------------------------------------------------------------+ +// +// $Id$ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Packager.php'; @@ -35,6 +53,24 @@ class PEAR_Command_Package extends PEAR_Command_Common } // }}} + + function getHelp($command) + { + switch ($command) { + case 'package': + return array('[]', + 'Creates a PEAR package from its description file (usually '. + 'named as package.xml)'); + case 'package-list': + return array('', + 'List the contents of a PEAR package'); + case 'packge-info': + return array('', + 'Shows information about a PEAR package'); + } + } + + // {{{ run() /** @@ -217,7 +253,6 @@ class PEAR_Command_Package extends PEAR_Command_Common // }}} - } ?> \ No newline at end of file -- 2.50.1