mirror of
https://github.com/php/php-src.git
synced 2025-08-17 22:48:57 +02:00
* implemented shortcuts ("pv" for "package-validate" etc.)
do "pear help shortcuts" to see what shortcuts exist * renamed "list-installed" command to "list" and made it able to list the contents of installed packages as well as tar/tgz/xml files * added some more/better command docs * fixed up the synopsis part in the help output * display option parameters (--foo=bar, where bar is specified in 'shortarg' as for example 'f:bar') * renamed list-remote-packages to list-remote * renamed remote-package-info to remote-info
This commit is contained in:
parent
f208968c9f
commit
7ecfacedad
9 changed files with 359 additions and 174 deletions
|
@ -129,13 +129,15 @@ if (empty($command) && ($store_user_config || $store_system_config)) {
|
|||
if ($fetype == 'Gtk') {
|
||||
Gtk::main();
|
||||
} else do {
|
||||
if (empty($all_commands[$command]) || $command == 'help') {
|
||||
if ($command == 'help') {
|
||||
usage(null, @$options[1][0]);
|
||||
}
|
||||
|
||||
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
|
||||
$cmd = PEAR_Command::factory($command, $config);
|
||||
PEAR::popErrorHandling();
|
||||
if (PEAR::isError($cmd)) {
|
||||
die($cmd->getMessage());
|
||||
usage(null, @$options[1][0]);
|
||||
}
|
||||
|
||||
$short_args = $long_args = null;
|
||||
|
@ -175,7 +177,6 @@ function usage($error = null, $helpsubject = null)
|
|||
{
|
||||
global $progname, $all_commands;
|
||||
$stderr = fopen('php://stderr', 'w');
|
||||
fputs($stderr, "\n");
|
||||
if (PEAR::isError($error)) {
|
||||
fputs($stderr, $error->getMessage() . "\n");
|
||||
} elseif ($error !== null) {
|
||||
|
@ -217,11 +218,18 @@ function cmdHelp($command)
|
|||
" -S store system configuration\n".
|
||||
" -u foo unset `foo' in the user configuration\n".
|
||||
" -h, -? display help/usage (this message)\n";
|
||||
} elseif ($command == "shortcuts") {
|
||||
$sc = PEAR_Command::getShortcuts();
|
||||
$ret = "Shortcuts:\n";
|
||||
foreach ($sc as $s => $c) {
|
||||
$ret .= sprintf(" %-8s %s\n", $s, $c);
|
||||
}
|
||||
return $ret;
|
||||
} elseif ($help = PEAR_Command::getHelp($command)) {
|
||||
if (is_string($help)) {
|
||||
return "$help\n";
|
||||
return "pear $command [options] $help\n";
|
||||
}
|
||||
return "{$help[0]}\n{$help[1]}";
|
||||
return "pear $command [options] $help[0]\n$help[1]";
|
||||
}
|
||||
return "No such command";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue