mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
quick fix for the "pear info" command
This commit is contained in:
parent
b9288f3515
commit
be45657eea
1 changed files with 13 additions and 4 deletions
|
@ -52,7 +52,6 @@ error_reporting(E_ALL & ~E_NOTICE);
|
|||
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n");
|
||||
|
||||
// {{{ config file and option parsing
|
||||
|
||||
$options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v");
|
||||
if (PEAR::isError($options)) {
|
||||
usage($options);
|
||||
|
@ -172,6 +171,7 @@ if (isset($command_options[$command])) {
|
|||
// }}}
|
||||
|
||||
switch ($command) {
|
||||
|
||||
// {{{ install
|
||||
|
||||
case 'install': case 'upgrade': {
|
||||
|
@ -384,15 +384,24 @@ function present_array(&$arr, $keys = null)
|
|||
if ($keys === null) {
|
||||
$keys = array_keys($arr);
|
||||
}
|
||||
$longest_key = max(array_map("strlen", array_keys($arr)));
|
||||
$longest_key = max(array_map("strlen", array_keys($arr))) + 2;
|
||||
$format_string = "%{$longest_key}s : %s\n";
|
||||
foreach ($keys as $k) {
|
||||
if (is_array($arr[$k])) {
|
||||
$v = implode(", ", $arr[$k]);
|
||||
foreach ($arr[$k] as $i => $value) {
|
||||
$x = "$k #$i";
|
||||
foreach(array_keys($value) as $val) {
|
||||
$cont[] = "$val=" . $value[$val];
|
||||
}
|
||||
$v = implode(", ", $cont);
|
||||
$cont = array();
|
||||
printf($format_string, $x, $v);
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
$v = $arr[$k];
|
||||
printf($format_string, $k, $v);
|
||||
}
|
||||
printf($format_string, $k, $v);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue