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
This commit is contained in:
Tomas V.V.Cox 2002-06-06 07:25:07 +00:00
parent ec9c0bf0a7
commit 41e7696ec9

View file

@ -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 <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
<version> The version to compare with <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'
)
); );
// }}} // }}}
@ -167,7 +174,8 @@ Tests if a package is installed in the system. Will exit(1) if it is not.
// }}} // }}}
// {{{ doShellTest() // {{{ doShellTest()
function doShellTest($command, $options, $params) { function doShellTest($command, $options, $params)
{
$this->pushErrorHandling(PEAR_ERROR_RETURN); $this->pushErrorHandling(PEAR_ERROR_RETURN);
$reg = &new PEAR_Registry($this->config->get('php_dir')); $reg = &new PEAR_Registry($this->config->get('php_dir'));
// "pear shell-test Foo" // "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);
}
// }}} // }}}
} }