cvs: pear-core /PEAR/Command Remote.php

From: Date: Mon, 15 Nov 2004 21:48:04 +0000
Subject: cvs: pear-core /PEAR/Command Remote.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-25993@lists.php.net to get a copy of this message
cellog Mon Nov 15 16:48:04 2004 EDT Modified files: /pear-core/PEAR/Command Remote.php Log: fix channel short option http://cvs.php.net/diff.php/pear-core/PEAR/Command/Remote.php?r1=1.45&r2=1.46&ty=u Index: pear-core/PEAR/Command/Remote.php diff -u pear-core/PEAR/Command/Remote.php:1.45 pear-core/PEAR/Command/Remote.php:1.46 --- pear-core/PEAR/Command/Remote.php:1.45 Fri Sep 24 01:24:23 2004 +++ pear-core/PEAR/Command/Remote.php Mon Nov 15 16:48:03 2004 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Remote.php,v 1.45 2004/09/24 05:24:23 cellog Exp $ +// $Id: Remote.php,v 1.46 2004/11/15 21:48:03 cellog Exp $ require_once 'PEAR/Command/Common.php'; require_once 'PEAR/Common.php'; @@ -46,6 +46,7 @@ array( 'shortopt' => 'c', 'doc' => 'specify a channel other than the default channel', + 'arg' => 'CHAN', ) ), 'doc' => '[preferred_state] @@ -62,6 +63,7 @@ array( 'shortopt' => 'c', 'doc' => 'specify a channel other than the default channel', + 'arg' => 'CHAN', ) ), 'doc' => ' @@ -72,8 +74,15 @@ 'summary' => 'Search remote package database', 'function' => 'doSearch', 'shortcut' => 'sp', - 'options' => array(), - 'doc' => '[[channel/]packagename] [packageinfo] + 'options' => array( + 'channel' => + array( + 'shortopt' => 'c', + 'doc' => 'specify a channel other than the default channel', + 'arg' => 'CHAN', + ) + ), + 'doc' => '[packagename] [packageinfo] Lists all packages which match the search parameters. The first parameter is a fragment of a packagename. The default channel will be used unless explicitly overridden. The second parameter @@ -88,6 +97,7 @@ array( 'shortopt' => 'c', 'doc' => 'specify a channel other than the default channel', + 'arg' => 'CHAN', ) ), 'doc' => ' @@ -146,15 +156,13 @@ $savechannel = $channel = $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); $package = $params[0]; - if (strpos($params[0], '/')) { - list($channel, $package) = explode('/', $params[0]); - if ($reg->channelExists($channel)) { - $this->config->set('default_channel', $channel); - } else { - return $this->raiseError("Channel '$channel' does not exist"); - } + $channel = isset($options['channel']) ? $options['channel'] : + $this->config->get('default_channel'); + if (!$reg->channelExists($channel)) { + return $this->raiseError('Channel "' . $channel . '" does not exist'); } - $r = new PEAR_Remote($this->config); + $this->config->set('default_channel', $channel); + $r = &$this->config->getRemote(); $info = $r->call('package.info', $package); if (PEAR::isError($info)) { $this->config->set('default_channel', $savechannel); @@ -185,7 +193,7 @@ return $this->raiseError("Channel '$channel' does not exist"); } } - $r = new PEAR_Remote($this->config); + $r = &$this->config->getRemote(); $list_options = false; if ($this->config->get('preferred_state') == 'stable') $list_options = true; @@ -226,8 +234,8 @@ return $this->raiseError("Channel '$channel' does not exist"); } } - $r = new PEAR_Remote($this->config); - $reg = $this->config->getRegistry(); + $r = &$this->config->getRemote(); + $reg = &$this->config->getRegistry(); $list_options = false; if ($this->config->get('preferred_state') == 'stable') $list_options = true; @@ -311,15 +319,16 @@ $savechannel = $channel = $this->config->get('default_channel'); $reg = &$this->config->getRegistry(); $package = $params[0]; - if (strpos($params[0], '/')) { - list($channel, $package) = explode('/', $params[0]); + if (isset($options['channel'])) { + $reg = &$this->config->getRegistry(); + $channel = $options['channel']; if ($reg->channelExists($channel)) { $this->config->set('default_channel', $channel); } else { return $this->raiseError("Channel '$channel' does not exist"); } } - $r = new PEAR_Remote($this->config); + $r = &$this->config->getRemote(); $available = $r->call('package.listAll', true, true); if (PEAR::isError($available)) { $this->config->set('default_channel', $savechannel); @@ -431,7 +440,7 @@ return $this->raiseError("Channel '$channel' does not exist"); } } - $remote = new PEAR_Remote($this->config); + $remote = &$this->config->getRemote(); $reg = &$this->config->getRegistry(); if (empty($params[1])) { $state = $this->config->get('preferred_state');

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