Skip to content

Commit 139f69c

Browse files
committed
Pass config to command factory and pass the correct command params
1 parent 47c71bc commit 139f69c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pear/scripts/pear.in

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ require_once "PEAR/Config.php";
2424
require_once "PEAR/Command.php";
2525
require_once "Console/Getopt.php";
2626

27-
error_reporting(E_ALL & ~E_NOTICE);
27+
error_reporting(E_ALL);
2828

2929
PEAR_Command::setUIType('CLI');
3030
$all_commands = PEAR_Command::getCommands();
@@ -81,10 +81,10 @@ foreach ($opts as $opt) {
8181
$config->remove($param, 'user');
8282
break;
8383
case 'v':
84-
$verbose++;
84+
$config->set('verbose', $verbose + 1);
8585
break;
8686
case 'q':
87-
$verbose--;
87+
$config->set('verbose', $verbose - 1);
8888
break;
8989
}
9090
}
@@ -107,11 +107,13 @@ if (empty($all_commands[$command]) || $command == 'help') {
107107
usage(null, @$options[1][2]);
108108
}
109109

110-
$cmd = PEAR_Command::factory($command);
110+
$cmd = PEAR_Command::factory($command, $config);
111111
if (PEAR::isError($cmd)) {
112112
die($cmd->getMessage());
113113
}
114-
$ok = $cmd->run($command, $cmdopts, $cmdargs);
114+
115+
$cmdargs = array_slice($options[1], 2);
116+
$ok = $cmd->run($command, $cmdargs);
115117
if ($ok === false) {
116118
PEAR::raiseError("unknown command `$command'");
117119
}
@@ -147,7 +149,7 @@ function usage($error = null, $helpsubject = null)
147149
} else {
148150
fputs($stderr,
149151
"Type \"$progname help options\" to list all options.\n");
150-
}
152+
}
151153
fputs($stderr,
152154
"Commands:\n " . implode("\n ", array_keys($all_commands)) .
153155
"\n");

0 commit comments

Comments
 (0)