]> granicus.if.org Git - php/commitdiff
* implemented "list-remote-packages" command
authorStig Bakken <ssb@php.net>
Sun, 28 Apr 2002 07:35:30 +0000 (07:35 +0000)
committerStig Bakken <ssb@php.net>
Sun, 28 Apr 2002 07:35:30 +0000 (07:35 +0000)
pear/PEAR/Command/Remote.php

index 87f73c38464a354aa769fc2733286e77379989e5..4014149a7f8d07618d1cbec32e55bdb847372cb7 100644 (file)
@@ -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;
             }