From: Tomas V.V.Cox Date: Thu, 21 Mar 2002 11:13:02 +0000 (+0000) Subject: Pass config to command factory and pass the correct command params X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~1165 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=139f69ca321010f2ef83e4c17ef773beb7911a52;p=php Pass config to command factory and pass the correct command params --- diff --git a/pear/scripts/pear.in b/pear/scripts/pear.in index 8afc9c8b84..18410821ad 100644 --- a/pear/scripts/pear.in +++ b/pear/scripts/pear.in @@ -24,7 +24,7 @@ require_once "PEAR/Config.php"; require_once "PEAR/Command.php"; require_once "Console/Getopt.php"; -error_reporting(E_ALL & ~E_NOTICE); +error_reporting(E_ALL); PEAR_Command::setUIType('CLI'); $all_commands = PEAR_Command::getCommands(); @@ -81,10 +81,10 @@ foreach ($opts as $opt) { $config->remove($param, 'user'); break; case 'v': - $verbose++; + $config->set('verbose', $verbose + 1); break; case 'q': - $verbose--; + $config->set('verbose', $verbose - 1); break; } } @@ -107,11 +107,13 @@ if (empty($all_commands[$command]) || $command == 'help') { usage(null, @$options[1][2]); } -$cmd = PEAR_Command::factory($command); +$cmd = PEAR_Command::factory($command, $config); if (PEAR::isError($cmd)) { die($cmd->getMessage()); } -$ok = $cmd->run($command, $cmdopts, $cmdargs); + +$cmdargs = array_slice($options[1], 2); +$ok = $cmd->run($command, $cmdargs); if ($ok === false) { PEAR::raiseError("unknown command `$command'"); } @@ -147,7 +149,7 @@ function usage($error = null, $helpsubject = null) } else { fputs($stderr, "Type \"$progname help options\" to list all options.\n"); - } + } fputs($stderr, "Commands:\n " . implode("\n ", array_keys($all_commands)) . "\n");