cvs: php4 /pear/scripts pear.in

From: Date: Sun, 12 May 2002 23:21:31 +0000
Subject: cvs: php4 /pear/scripts pear.in
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-3790@lists.php.net to get a copy of this message
ssb Sun May 12 19:21:31 2002 EDT Modified files: /php4/pear/scripts pear.in Log: * fix option parsing Index: php4/pear/scripts/pear.in diff -u php4/pear/scripts/pear.in:1.45 php4/pear/scripts/pear.in:1.46 --- php4/pear/scripts/pear.in:1.45 Sun May 12 17:09:04 2002 +++ php4/pear/scripts/pear.in Sun May 12 19:21:30 2002 @@ -126,7 +126,7 @@ if ($fetype == 'Gtk') { Gtk::main(); -} else { +} else do { if (empty($all_commands[$command]) || $command == 'help') { usage(null, @$options[1][2]); } @@ -136,38 +136,36 @@ die($cmd->getMessage()); } - $short_args = $long_args = array(); + $short_args = $long_args = null; PEAR_Command::getGetoptArgs($command, $short_args, $long_args); - if (PEAR::isError($tmp = Console_Getopt::getopt($params, $short_args, $long_args))) { - return $this->raiseError($tmp); + if (PEAR::isError($tmp = Console_Getopt::getopt($options[1], $short_args, $long_args))) { + break; } list($tmpopt, $params) = $tmp; - $options = array(); + $opts = array(); foreach ($tmpopt as $foo => $tmp2) { list($opt, $value) = $tmp2; if ($value === null) { - $value = true; + $value = true; // options without args } if (strlen($opt) == 1) { - foreach ($this->commands[$command]['options'] as $o => $d) { + $cmdoptions = $cmd->getOptions($command); + foreach ($cmdoptions as $o => $d) { if (@$d['shortopt'] == $opt) { - $options[$o] = $value; + $opts[$o] = $value; } } } else { if (substr($opt, 0, 2) == '--') { - $options[substr($opt, 2)] = $value; - } + $opts[substr($opt, 2)] = $value; } } - - - - $ok = $cmd->run($command, $options[1]); + } + $ok = $cmd->run($command, $opts, $params); if ($ok === false) { PEAR::raiseError("unknown command `$command'"); } -} +} while (false); // {{{ usage()

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