mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-09 00:12:40 +01:00
[Wilds] Sort of make "arc help" work again
Summary: Ref T13098. This makes "arc help" kind-of sort-of work again. Previously, "arc help" was completely custom and hard-coded. Now it just proxies the generic libphutil "help" workflow. The two flows are substantially similar, although old `arc help` was a little more brief than the new version is. The old `arc help --full` was more similar to the default: | Command | Old Behavior | New Behavior | |---|---|---| | `arc` | Tells you to run `arc help`. | Plan: make this a bit richer and give a quick summary of workflows. | | `arc help` | Gives you a summary of workflows. | Gives you a detailed list of workflows. | | `arc help --full` | Gives you a detailed list of workflows. | No such flag. | | `arc --help` | Same as `arc help`. | Same as `arc`. Plan: same as `arc help`. | | `arc help <workflow>` | Full workflow help. | Full workflow help. | | `arc <workflow> --help` | As above. | As above. | Overall this is largely the same and lets us delete a bunch of code. Test Plan: Ran `arc`, `arc help`, `arc --help`, `arc --help diff`, `arc diff --help`, `arc help diff`, `arc help help`. These commands largely do something sensible now, with caveats per above. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13098 Differential Revision: https://secure.phabricator.com/D19679
This commit is contained in:
parent
8e51f89c79
commit
baadc1f842
4 changed files with 27 additions and 1 deletions
|
@ -75,6 +75,17 @@ final class ArcanistRuntime {
|
||||||
|
|
||||||
$unconsumed_argv = $args->getUnconsumedArgumentVector();
|
$unconsumed_argv = $args->getUnconsumedArgumentVector();
|
||||||
|
|
||||||
|
if (!$unconsumed_argv) {
|
||||||
|
// TOOLSETS: This means the user just ran "arc" or some other top-level
|
||||||
|
// toolset without any workflow argument. We should give them a summary
|
||||||
|
// of the toolset, a list of workflows, and a pointer to "arc help" for
|
||||||
|
// more details.
|
||||||
|
|
||||||
|
// A possible exception is "arc --help", which should perhaps pass
|
||||||
|
// through and act like "arc help".
|
||||||
|
throw new PhutilArgumentUsageException(pht('Choose a workflow!'));
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->resolveAliases($workflows, $unconsumed_argv, $config);
|
$result = $this->resolveAliases($workflows, $unconsumed_argv, $config);
|
||||||
if (is_int($result)) {
|
if (is_int($result)) {
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -187,6 +187,7 @@ phutil_register_library_map(array(
|
||||||
'ArcanistHLintLinter' => 'lint/linter/ArcanistHLintLinter.php',
|
'ArcanistHLintLinter' => 'lint/linter/ArcanistHLintLinter.php',
|
||||||
'ArcanistHLintLinterTestCase' => 'lint/linter/__tests__/ArcanistHLintLinterTestCase.php',
|
'ArcanistHLintLinterTestCase' => 'lint/linter/__tests__/ArcanistHLintLinterTestCase.php',
|
||||||
'ArcanistHardpointLoader' => 'loader/ArcanistHardpointLoader.php',
|
'ArcanistHardpointLoader' => 'loader/ArcanistHardpointLoader.php',
|
||||||
|
'ArcanistHelpWorkflow' => 'toolset/ArcanistHelpWorkflow.php',
|
||||||
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistHexadecimalNumericScalarCasingXHPASTLinterRule.php',
|
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistHexadecimalNumericScalarCasingXHPASTLinterRule.php',
|
||||||
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistHexadecimalNumericScalarCasingXHPASTLinterRuleTestCase.php',
|
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistHexadecimalNumericScalarCasingXHPASTLinterRuleTestCase.php',
|
||||||
'ArcanistHgClientChannel' => 'hgdaemon/ArcanistHgClientChannel.php',
|
'ArcanistHgClientChannel' => 'hgdaemon/ArcanistHgClientChannel.php',
|
||||||
|
@ -639,6 +640,7 @@ phutil_register_library_map(array(
|
||||||
'ArcanistHLintLinter' => 'ArcanistExternalLinter',
|
'ArcanistHLintLinter' => 'ArcanistExternalLinter',
|
||||||
'ArcanistHLintLinterTestCase' => 'ArcanistExternalLinterTestCase',
|
'ArcanistHLintLinterTestCase' => 'ArcanistExternalLinterTestCase',
|
||||||
'ArcanistHardpointLoader' => 'Phobject',
|
'ArcanistHardpointLoader' => 'Phobject',
|
||||||
|
'ArcanistHelpWorkflow' => 'ArcanistWorkflow',
|
||||||
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
|
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
|
||||||
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
|
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
|
||||||
'ArcanistHgClientChannel' => 'PhutilProtocolChannel',
|
'ArcanistHgClientChannel' => 'PhutilProtocolChannel',
|
||||||
|
|
|
@ -132,7 +132,7 @@ EOTEXT
|
||||||
|
|
||||||
public static function resolveAliases(
|
public static function resolveAliases(
|
||||||
$command,
|
$command,
|
||||||
ArcanistConfiguration $config,
|
ArcanistRuntime $config,
|
||||||
array $argv,
|
array $argv,
|
||||||
ArcanistConfigurationManager $configuration_manager) {
|
ArcanistConfigurationManager $configuration_manager) {
|
||||||
|
|
||||||
|
|
13
src/toolset/ArcanistHelpWorkflow.php
Normal file
13
src/toolset/ArcanistHelpWorkflow.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ArcanistHelpWorkflow extends ArcanistWorkflow {
|
||||||
|
|
||||||
|
public function getWorkflowName() {
|
||||||
|
return 'help';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newPhutilWorkflow() {
|
||||||
|
return new PhutilHelpArgumentWorkflow();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue