From: Tomas V.V.Cox Date: Thu, 6 Jun 2002 07:25:07 +0000 (+0000) Subject: Implemented "pear info " command X-Git-Tag: RELEASE_0_90~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41e7696ec97f95d3f3d7a9664ef1b0d44ca36f9b;p=php Implemented "pear info " command # Stig, why I'm sure that you already have implemented this # command? Have to stop with my LSD therapy --- diff --git a/pear/PEAR/Command/Registry.php b/pear/PEAR/Command/Registry.php index 1196a870c6..84ba59decf 100644 --- a/pear/PEAR/Command/Registry.php +++ b/pear/PEAR/Command/Registry.php @@ -50,6 +50,13 @@ Tests if a package is installed in the system. Will exit(1) if it is not. <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne 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 @@ Tests if a package is installed in the system. Will exit(1) if it is not. } $this->ui->outputData($data, $command); - + } return true; } @@ -167,7 +174,8 @@ Tests if a package is installed in the system. Will exit(1) if it is not. // }}} // {{{ 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" @@ -194,6 +202,27 @@ Tests if a package is installed in the system. Will exit(1) if it is not. } } + // }}} + // {{{ 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); + } + // }}} }