|
211 | 211 | ->setUniqueMethod('getName')
|
212 | 212 | ->execute();
|
213 | 213 |
|
| 214 | + $command_list = array_keys($workflows); |
| 215 | + $command_list = implode(', ', $command_list); |
| 216 | + |
| 217 | + $error_lines = array(); |
| 218 | + $error_lines[] = pht('Welcome to Phabricator.'); |
| 219 | + $error_lines[] = pht( |
| 220 | + 'You are logged in as %s.', |
| 221 | + $user_name); |
| 222 | + |
214 | 223 | if (!$original_argv) {
|
215 |
| - throw new Exception( |
216 |
| - pht( |
217 |
| - "Welcome to Phabricator.\n\n". |
218 |
| - "You are logged in as %s.\n\n". |
219 |
| - "You haven't specified a command to run. This means you're requesting ". |
220 |
| - "an interactive shell, but Phabricator does not provide an ". |
221 |
| - "interactive shell over SSH.\n\n". |
222 |
| - "Usually, you should run a command like `%s` or `%s` ". |
223 |
| - "rather than connecting directly with SSH.\n\n". |
224 |
| - "Supported commands are: %s.", |
225 |
| - $user_name, |
226 |
| - 'git clone', |
227 |
| - 'hg push', |
228 |
| - implode(', ', array_keys($workflows)))); |
| 224 | + $error_lines[] = pht( |
| 225 | + 'You have not specified a command to run. This means you are requesting '. |
| 226 | + 'an interactive shell, but Phabricator does not provide interactive '. |
| 227 | + 'shells over SSH.'); |
| 228 | + $error_lines[] = pht( |
| 229 | + '(Usually, you should run a command like "git clone" or "hg push" '. |
| 230 | + 'instead of connecting directly with SSH.)'); |
| 231 | + $error_lines[] = pht( |
| 232 | + 'Supported commands are: %s.', |
| 233 | + $command_list); |
| 234 | + |
| 235 | + $error_lines = implode("\n\n", $error_lines); |
| 236 | + throw new PhutilArgumentUsageException($error_lines); |
229 | 237 | }
|
230 | 238 |
|
231 | 239 | $log_argv = implode(' ', $original_argv);
|
|
247 | 255 | $parsed_args = new PhutilArgumentParser($parseable_argv);
|
248 | 256 |
|
249 | 257 | if (empty($workflows[$command])) {
|
250 |
| - throw new Exception(pht('Invalid command.')); |
| 258 | + $error_lines[] = pht( |
| 259 | + 'You have specified the command "%s", but that command is not '. |
| 260 | + 'supported by Phabricator. As received by Phabricator, your entire '. |
| 261 | + 'argument list was:', |
| 262 | + $command); |
| 263 | + |
| 264 | + $error_lines[] = csprintf(' $ ssh ... -- %Ls', $parseable_argv); |
| 265 | + |
| 266 | + $error_lines[] = pht( |
| 267 | + 'Supported commands are: %s.', |
| 268 | + $command_list); |
| 269 | + |
| 270 | + $error_lines = implode("\n\n", $error_lines); |
| 271 | + throw new PhutilArgumentUsageException($error_lines); |
251 | 272 | }
|
252 | 273 |
|
253 | 274 | $workflow = $parsed_args->parseWorkflows($workflows);
|
|
0 commit comments