From: Stig Bakken Date: Sun, 28 Apr 2002 07:35:30 +0000 (+0000) Subject: * implemented "list-remote-packages" command X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~386 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eade67d6ab9de13de1cdc8f52c1b7912b7d3cf64;p=php * implemented "list-remote-packages" command --- diff --git a/pear/PEAR/Command/Remote.php b/pear/PEAR/Command/Remote.php index 87f73c3846..4014149a7f 100644 --- a/pear/PEAR/Command/Remote.php +++ b/pear/PEAR/Command/Remote.php @@ -86,6 +86,27 @@ class PEAR_Command_Remote extends PEAR_Command_Common // {{{ list-remote-packages case 'list-remote-packages': { + $r = new PEAR_Remote($this->config); + $available = $r->call('package.listAll', true); + if (PEAR::isError($available)) { + return $this->raiseError($available); + } + $i = $j = 0; + $this->ui->startTable( + array('caption' => 'Available packages:', + 'border' => true)); + foreach ($available as $name => $info) { + if ($i++ % 20 == 0) { + $this->ui->tableRow( + array('Package', 'Version'), + array('bold' => true)); + } + $this->ui->tableRow(array($name, $info['stable'])); + } + if ($i == 0) { + $this->ui->tableRow(array('(no packages installed yet)')); + } + $this->ui->endTable(); break; }