Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistHelpWorkflow.php
| Show All 40 Lines | public function run() { | ||||
| $workflows = $arc_config->buildAllWorkflows(); | $workflows = $arc_config->buildAllWorkflows(); | ||||
| ksort($workflows); | ksort($workflows); | ||||
| $target = null; | $target = null; | ||||
| if ($this->getArgument('command')) { | if ($this->getArgument('command')) { | ||||
| $target = head($this->getArgument('command')); | $target = head($this->getArgument('command')); | ||||
| if (empty($workflows[$target])) { | if (empty($workflows[$target])) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| "Unrecognized command '{$target}'. Try 'arc help'."); | pht( | ||||
| "Unrecognized command '%s'. Try '%s'.", | |||||
| $target, | |||||
| 'arc help')); | |||||
| } | } | ||||
| } | } | ||||
| $cmdref = array(); | $cmdref = array(); | ||||
| foreach ($workflows as $command => $workflow) { | foreach ($workflows as $command => $workflow) { | ||||
| if ($target && $target != $command) { | if ($target && $target != $command) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | foreach ($workflows as $command => $workflow) { | ||||
| } else { | } else { | ||||
| $optref[] = phutil_console_format( | $optref[] = phutil_console_format( | ||||
| ' __--%s__', | ' __--%s__', | ||||
| $argument); | $argument); | ||||
| } | } | ||||
| } | } | ||||
| if (isset($config_arguments[$argument])) { | if (isset($config_arguments[$argument])) { | ||||
| $optref[] = ' (This is a custom option for this '. | $optref[] = ' '. | ||||
| 'project.)'; | pht('(This is a custom option for this project.)'); | ||||
| } | } | ||||
| if (isset($spec['supports'])) { | if (isset($spec['supports'])) { | ||||
| $optref[] = ' Supports: '. | $optref[] = ' '. | ||||
| implode(', ', $spec['supports']); | pht('Supports: %s', implode(', ', $spec['supports'])); | ||||
| } | } | ||||
| if (isset($spec['help'])) { | if (isset($spec['help'])) { | ||||
| $docs = $spec['help']; | $docs = $spec['help']; | ||||
| } else { | } else { | ||||
| $docs = 'This option is not documented.'; | $docs = pht('This option is not documented.'); | ||||
| } | } | ||||
| $docs = phutil_console_wrap($docs, 14); | $docs = phutil_console_wrap($docs, 14); | ||||
| $optref[] = "{$docs}\n"; | $optref[] = "{$docs}\n"; | ||||
| } | } | ||||
| if ($optref) { | if ($optref) { | ||||
| $optref = implode("\n", $optref); | $optref = implode("\n", $optref); | ||||
| $optref = "\n\n".$optref; | $optref = "\n\n".$optref; | ||||
| } else { | } else { | ||||
| Show All 25 Lines | |||||
| {$cmdref} | {$cmdref} | ||||
| EOTEXT | EOTEXT | ||||
| ); | ); | ||||
| if (!$this->getArgument('full')) { | if (!$this->getArgument('full')) { | ||||
| echo "Run 'arc help --full' to get commands and options descriptions.\n"; | echo pht( | ||||
| "Run '%s' to get commands and options descriptions.\n", | |||||
| 'arc help --full'); | |||||
| return; | return; | ||||
| } | } | ||||
| echo phutil_console_format(<<<EOTEXT | echo phutil_console_format(<<<EOTEXT | ||||
| **OPTION REFERENCE** | **OPTION REFERENCE** | ||||
| __--trace__ | __--trace__ | ||||
| Debugging command. Shows underlying commands as they are executed, | Debugging command. Shows underlying commands as they are executed, | ||||
| ▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines | |||||