cvs: php4 /pear/PEAR/Command Registry.php
| From: | Tomas V.V.Cox | Date: | Thu, 06 Jun 2002 07:25:07 +0000 |
| Subject: | cvs: php4 /pear/PEAR/Command Registry.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4435@lists.php.net to get a copy of this message | ||
cox Thu Jun 6 03:25:07 2002 EDT
Modified files:
/php4/pear/PEAR/Command Registry.php
Log:
Implemented "pear info <Installed Package>" command
# Stig, why I'm sure that you already have implemented this
# command? Have to stop with my LSD therapy
Index: php4/pear/PEAR/Command/Registry.php
diff -u php4/pear/PEAR/Command/Registry.php:1.19 php4/pear/PEAR/Command/Registry.php:1.20
--- php4/pear/PEAR/Command/Registry.php:1.19 Tue Jun 4 11:25:23 2002
+++ php4/pear/PEAR/Command/Registry.php Thu Jun 6 03:25:07 2002
@@ -17,7 +17,7 @@
// | |
// +----------------------------------------------------------------------+
//
-// $Id: Registry.php,v 1.19 2002/06/04 15:25:23 ssb Exp $
+// $Id: Registry.php,v 1.20 2002/06/06 07:25:07 cox Exp $
require_once 'PEAR/Command/Common.php';
require_once 'PEAR/Registry.php';
@@ -50,6 +50,13 @@
<, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
<version> The version to compare with
'),
+ 'info' => array(
+ 'summary' => 'Information of an installed package',
+ 'function' => 'doInfo',
+ 'shortcut' => 'i',
+ 'options' => array(),
+ 'doc' => '[package] Displays the information of an installed
package'
+ )
);
// }}}
@@ -159,7 +166,7 @@
}
$this->ui->outputData($data, $command);
-
+
}
return true;
}
@@ -167,7 +174,8 @@
// }}}
// {{{ doShellTest()
- function doShellTest($command, $options, $params) {
+ function doShellTest($command, $options, $params)
+ {
$this->pushErrorHandling(PEAR_ERROR_RETURN);
$reg = &new PEAR_Registry($this->config->get('php_dir'));
// "pear shell-test Foo"
@@ -192,6 +200,27 @@
$this->raiseError("$command: expects 1 to 3 parameters");
exit(1);
}
+ }
+
+ // }}}
+ // {{{ doInfo
+
+ function doInfo($command, $options, $params)
+ {
+ // $params[0] The package for showing info
+ if (sizeof($params) != 1) {
+ return $this->raiseError("This command only accepts one param: ".
+ "the package you want information");
+ }
+ $package = $params[0];
+ $reg = &new PEAR_Registry($this->config->get('php_dir'));
+ if (!$reg->packageExists($package)) {
+ return $this->raiseError("The package $package is not installed");
+ }
+ $info = $reg->packageInfo($package);
+ include_once 'PEAR/Command/Package.php';
+ $data = &PEAR_Command_Package::_infoForDisplaying($info);
+ $this->ui->outputData($data, $command);
}
// }}}