cvs: php4 /pear/PEAR/Command Remote.php /pear/PEAR/Frontend CLI.php

From: Date: Fri, 07 Jun 2002 15:06:28 +0000
Subject: cvs: php4 /pear/PEAR/Command Remote.php /pear/PEAR/Frontend CLI.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4483@lists.php.net to get a copy of this message
cox Fri Jun 7 11:06:28 2002 EDT Modified files: /php4/pear/PEAR/Frontend CLI.php /php4/pear/PEAR/Command Remote.php Log: Beautify remote-info Index: php4/pear/PEAR/Frontend/CLI.php diff -u php4/pear/PEAR/Frontend/CLI.php:1.18 php4/pear/PEAR/Frontend/CLI.php:1.19 --- php4/pear/PEAR/Frontend/CLI.php:1.18 Fri Jun 7 10:48:01 2002 +++ php4/pear/PEAR/Frontend/CLI.php Fri Jun 7 11:06:23 2002 @@ -16,7 +16,7 @@ | Author: Stig Sæther Bakken <ssb@fast.no> | +----------------------------------------------------------------------+ - $Id: CLI.php,v 1.18 2002/06/07 14:48:01 cox Exp $ + $Id: CLI.php,v 1.19 2002/06/07 15:06:23 cox Exp $ */ require_once "PEAR.php"; @@ -398,14 +398,14 @@ case 'remote-info': $data = array( 'caption' => 'Package details:', - 'border' => false, + 'border' => true, 'data' => array( - array("Latest", $data['stable']), + array("Latest", $data['stable']), array("Installed", $data['installed']), - array("Package", $data['name']), - array("License", $data['license']), - array("Category", $data['category']), - array("Summary", $data['summary']), + array("Package", $data['name']), + array("License", $data['license']), + array("Category", $data['category']), + array("Summary", $data['summary']), array("Description", $data['description']), ), ); @@ -418,7 +418,7 @@ $opts = array(0 => array('wrap' => 25), 1 => array('wrap' => 55) ); - } else { + } elseif ($count == 3) { $opts = array(0 => array('wrap' => 20), 1 => array('wrap' => 20), 2 => array('wrap' => 40) Index: php4/pear/PEAR/Command/Remote.php diff -u php4/pear/PEAR/Command/Remote.php:1.14 php4/pear/PEAR/Command/Remote.php:1.15 --- php4/pear/PEAR/Command/Remote.php:1.14 Sun Jun 2 16:13:50 2002 +++ php4/pear/PEAR/Command/Remote.php Fri Jun 7 11:06:25 2002 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.14 2002/06/02 20:13:50 dickmann Exp $ +// $Id: Remote.php,v 1.15 2002/06/07 15:06:25 cox Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Common.php'; @@ -61,7 +61,7 @@ 'shortcut' => 'sp', 'options' => array(), 'doc' => ' -Lists all packages which match the search paramteres (first param +Lists all packages which match the search paramteres (first param is package name, second package info)', ), 'list-all' => array( @@ -109,18 +109,9 @@ function doRemoteInfo($command, $options, $params) { -/* - return false; // coming soon - - var_dump($params[0]); - $r = new PEAR_Remote($this->config); - $info = $r->call('package.info', $params[0]); - if (PEAR::isError($info)) { - return $this->raiseError($info); - } - - var_dump($info); -*/ + if (sizeof($params) != 1) { + return $this->raiseError("$command expects one param: the remote package name"); + } $r = new PEAR_Remote($this->config); $available = $r->call('package.listAll', true); if (PEAR::isError($available)) { @@ -131,11 +122,9 @@ $reg = new PEAR_Registry($this->config->get('php_dir')); $installed = $reg->packageInfo($info['name']); - $info['installed'] = $installed['version']; - + $info['installed'] = $installed['version'] ? $installed['version'] : '- no -'; + $this->ui->outputData($info, $command); - - return true; // coming soon } // }}} @@ -180,16 +169,16 @@ 'border' => true, 'headline' => array('Package', 'Latest', 'Local'), ); - + foreach ($available as $name => $info) { $installed = $reg->packageInfo($name); $desc = $info['summary']; if (isset($params[$name])) $desc .= "\n\n".$info['description']; - + $data['data'][$info['category']][] = array( - $name, - $info['stable'], + $name, + $info['stable'], $installed['version'], $desc, ); @@ -206,9 +195,9 @@ if ((!isset($params[0]) || empty($params[0])) && (!isset($params[1]) || empty($params[1]))) { - return $this->raiseError('no valid search string suppliedy<'); + return $this->raiseError('no valid search string supplied'); }; - + $r = new PEAR_Remote($this->config); $reg = new PEAR_Registry($this->config->get('php_dir')); $available = $r->call('package.listAll', true); @@ -220,24 +209,24 @@ 'border' => true, 'headline' => array('Package', 'Latest', 'Local'), ); - + foreach ($available as $name => $info) { $found = (!empty($params[0]) && stristr($name, $params[0]) !== false); if (!$found && !(isset($params[1]) && !empty($params[1]) && (stristr($info['summary'], $params[1]) !== false || stristr($info['description'], $params[1]) !== false))) - { + { continue; }; - + $installed = $reg->packageInfo($name); $desc = $info['summary']; if (isset($params[$name])) $desc .= "\n\n".$info['description']; - + $data['data'][$info['category']][] = array( - $name, - $info['stable'], + $name, + $info['stable'], $installed['version'], $desc, );

« previous php.pear.cvs (#4483) next »