Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15377529
D20991.id50017.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Referenced Files
None
Subscribers
None
D20991.id50017.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -30,6 +30,7 @@
'ArcanistAnoidWorkflow' => 'workflow/ArcanistAnoidWorkflow.php',
'ArcanistArcConfigurationEngineExtension' => 'config/arc/ArcanistArcConfigurationEngineExtension.php',
'ArcanistArcToolset' => 'toolset/ArcanistArcToolset.php',
+ 'ArcanistArcWorkflow' => 'toolset/workflow/ArcanistArcWorkflow.php',
'ArcanistArrayCombineXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistArrayCombineXHPASTLinterRule.php',
'ArcanistArrayCombineXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistArrayCombineXHPASTLinterRuleTestCase.php',
'ArcanistArrayIndexSpacingXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistArrayIndexSpacingXHPASTLinterRule.php',
@@ -213,7 +214,7 @@
'ArcanistHLintLinter' => 'lint/linter/ArcanistHLintLinter.php',
'ArcanistHLintLinterTestCase' => 'lint/linter/__tests__/ArcanistHLintLinterTestCase.php',
'ArcanistHardpointLoader' => 'loader/ArcanistHardpointLoader.php',
- 'ArcanistHelpWorkflow' => 'workflow/ArcanistHelpWorkflow.php',
+ 'ArcanistHelpWorkflow' => 'toolset/workflow/ArcanistHelpWorkflow.php',
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRule' => 'lint/linter/xhpast/rules/ArcanistHexadecimalNumericScalarCasingXHPASTLinterRule.php',
'ArcanistHexadecimalNumericScalarCasingXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistHexadecimalNumericScalarCasingXHPASTLinterRuleTestCase.php',
'ArcanistHgClientChannel' => 'hgdaemon/ArcanistHgClientChannel.php',
@@ -968,6 +969,7 @@
'ArcanistAnoidWorkflow' => 'ArcanistWorkflow',
'ArcanistArcConfigurationEngineExtension' => 'ArcanistConfigurationEngineExtension',
'ArcanistArcToolset' => 'ArcanistToolset',
+ 'ArcanistArcWorkflow' => 'ArcanistWorkflow',
'ArcanistArrayCombineXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
'ArcanistArrayCombineXHPASTLinterRuleTestCase' => 'ArcanistXHPASTLinterRuleTestCase',
'ArcanistArrayIndexSpacingXHPASTLinterRule' => 'ArcanistXHPASTLinterRule',
diff --git a/src/toolset/workflow/ArcanistArcWorkflow.php b/src/toolset/workflow/ArcanistArcWorkflow.php
new file mode 100644
--- /dev/null
+++ b/src/toolset/workflow/ArcanistArcWorkflow.php
@@ -0,0 +1,11 @@
+<?php
+
+abstract class ArcanistArcWorkflow
+ extends ArcanistWorkflow {
+
+ public function supportsToolset(ArcanistToolset $toolset) {
+ $key = $toolset->getToolsetKey();
+ return ($key === 'arc');
+ }
+
+}
diff --git a/src/toolset/workflow/ArcanistHelpWorkflow.php b/src/toolset/workflow/ArcanistHelpWorkflow.php
new file mode 100644
--- /dev/null
+++ b/src/toolset/workflow/ArcanistHelpWorkflow.php
@@ -0,0 +1,18 @@
+<?php
+
+final class ArcanistHelpWorkflow
+ extends ArcanistWorkflow {
+
+ public function getWorkflowName() {
+ return 'help';
+ }
+
+ public function newPhutilWorkflow() {
+ return new PhutilHelpArgumentWorkflow();
+ }
+
+ public function supportsToolset(ArcanistToolset $toolset) {
+ return true;
+ }
+
+}
diff --git a/src/workflow/ArcanistHelpWorkflow.php b/src/workflow/ArcanistHelpWorkflow.php
deleted file mode 100644
--- a/src/workflow/ArcanistHelpWorkflow.php
+++ /dev/null
@@ -1,221 +0,0 @@
-<?php
-
-/**
- * Seduces the reader with majestic prose.
- */
-final class ArcanistHelpWorkflow extends ArcanistWorkflow {
-
- public function getWorkflowName() {
- return 'help';
- }
-
- public function getCommandSynopses() {
- return phutil_console_format(<<<EOTEXT
- **help** [__command__]
- **help** --full
-EOTEXT
- );
- }
-
- public function getCommandHelp() {
- return phutil_console_format(<<<EOTEXT
- Supports: english
- Shows this help. With __command__, shows help about a specific
- command.
-EOTEXT
- );
- }
-
- public function getArguments() {
- return array(
- 'full' => array(
- 'help' => pht('Print detailed information about each command.'),
- ),
- '*' => 'command',
- );
- }
-
- public function run() {
-
- $arc_config = $this->getArcanistConfiguration();
- $workflows = $arc_config->buildAllWorkflows();
- ksort($workflows);
-
- $target = null;
- if ($this->getArgument('command')) {
- $target = head($this->getArgument('command'));
- if (empty($workflows[$target])) {
- throw new ArcanistUsageException(
- pht(
- "Unrecognized command '%s'. Try '%s'.",
- $target,
- 'arc help'));
- }
- }
-
- $cmdref = array();
- foreach ($workflows as $command => $workflow) {
- if ($target && $target != $command) {
- continue;
- }
- if (!$target && !$this->getArgument('full')) {
- $cmdref[] = $workflow->getCommandSynopses();
- continue;
- }
- $optref = array();
- $arguments = $workflow->getArguments();
-
- $config_arguments = $arc_config->getCustomArgumentsForCommand($command);
-
- // This juggling is to put the extension arguments after the normal
- // arguments, and make sure the normal arguments aren't overwritten.
- ksort($arguments);
- ksort($config_arguments);
- foreach ($config_arguments as $argument => $spec) {
- if (empty($arguments[$argument])) {
- $arguments[$argument] = $spec;
- }
- }
-
- foreach ($arguments as $argument => $spec) {
- if ($argument == '*') {
- continue;
- }
- if (!empty($spec['hide'])) {
- continue;
- }
- if (isset($spec['param'])) {
- if (isset($spec['short'])) {
- $optref[] = phutil_console_format(
- ' __--%s__ __%s__, __-%s__ __%s__',
- $argument,
- $spec['param'],
- $spec['short'],
- $spec['param']);
- } else {
- $optref[] = phutil_console_format(
- ' __--%s__ __%s__',
- $argument,
- $spec['param']);
- }
- } else {
- if (isset($spec['short'])) {
- $optref[] = phutil_console_format(
- ' __--%s__, __-%s__',
- $argument,
- $spec['short']);
- } else {
- $optref[] = phutil_console_format(
- ' __--%s__',
- $argument);
- }
- }
-
- if (isset($config_arguments[$argument])) {
- $optref[] = ' '.
- pht('(This is a custom option for this project.)');
- }
-
- if (isset($spec['supports'])) {
- $optref[] = ' '.
- pht('Supports: %s', implode(', ', $spec['supports']));
- }
-
- if (isset($spec['help'])) {
- $docs = $spec['help'];
- } else {
- $docs = pht('This option is not documented.');
- }
- $docs = phutil_console_wrap($docs, 14);
- $optref[] = "{$docs}\n";
- }
- if ($optref) {
- $optref = implode("\n", $optref);
- $optref = "\n\n".$optref;
- } else {
- $optref = "\n";
- }
-
- $cmdref[] =
- $workflow->getCommandSynopses()."\n".
- $workflow->getCommandHelp().
- $optref;
- }
- $cmdref = implode("\n\n", $cmdref);
-
- if ($target) {
- echo "\n".$cmdref."\n";
- return;
- }
-
- $self = 'arc';
- echo phutil_console_format(<<<EOTEXT
-**NAME**
- **{$self}** - arcanist, a code review and revision management utility
-
-**SYNOPSIS**
- **{$self}** __command__ [__options__] [__args__]
- This help file provides a detailed command reference.
-
-**COMMAND REFERENCE**
-
-{$cmdref}
-
-
-EOTEXT
- );
-
- if (!$this->getArgument('full')) {
- echo pht(
- "Run '%s' to get commands and options descriptions.\n",
- 'arc help --full');
- return;
- }
-
- echo phutil_console_format(<<<EOTEXT
-**OPTION REFERENCE**
-
- __--trace__
- Debugging command. Shows underlying commands as they are executed,
- and full stack traces when exceptions are thrown.
-
- __--no-ansi__
- Output in plain ASCII text only, without color or style.
-
- __--ansi__
- Use formatting even in environments which probably don't support it.
- Example: arc --ansi unit | less -r
-
- __--load-phutil-library=/path/to/library__
- Ignore libraries listed in .arcconfig and explicitly load specified
- libraries instead. Mostly useful for Arcanist development.
-
- __--conduit-uri__ __uri__
- Ignore configured Conduit URI and use an explicit one instead. Mostly
- useful for Arcanist development.
-
- __--conduit-token__ __token__
- Ignore configured credentials and use an explicit API token instead.
-
- __--conduit-version__ __version__
- Ignore software version and claim to be running some other version
- instead. Mostly useful for Arcanist development. May cause bad things
- to happen.
-
- __--conduit-timeout__ __timeout__
- Override the default Conduit timeout. Specified in seconds.
-
- __--config__ __key=value__
- Specify a runtime configuration value. This will take precedence
- over static values, and only affect the current arcanist invocation.
-
- __--skip-arcconfig__
- Skip the working copy configuration file
-
- __--arcrc-file__ __filename__
- Use provided file instead of ~/.arcrc.
-
-EOTEXT
- );
- }
-}
diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php
--- a/src/workflow/ArcanistWorkflow.php
+++ b/src/workflow/ArcanistWorkflow.php
@@ -72,11 +72,54 @@
private $changeCache = array();
private $conduitEngine;
+ private $toolset;
+ private $runtime;
+ private $configurationEngine;
+ private $configurationSourceList;
- public function __construct() {}
+ final public function setToolset(ArcanistToolset $toolset) {
+ $this->toolset = $toolset;
+ return $this;
+ }
+
+ final public function getToolset() {
+ return $this->toolset;
+ }
+
+ final public function setRuntime(ArcanistRuntime $runtime) {
+ $this->runtime = $runtime;
+ return $this;
+ }
+
+ final public function getRuntime() {
+ return $this->runtime;
+ }
+
+ final public function setConfigurationEngine(
+ ArcanistConfigurationEngine $engine) {
+ $this->configurationEngine = $engine;
+ return $this;
+ }
+ final public function getConfigurationEngine() {
+ return $this->configurationEngine;
+ }
+
+ final public function setConfigurationSourceList(
+ ArcanistConfigurationSourceList $list) {
+ $this->configurationSourceList = $list;
+ return $this;
+ }
- abstract public function run();
+ final public function getConfigurationSourceList() {
+ return $this->configurationSourceList;
+ }
+
+ public function __construct() {}
+
+ public function run() {
+ throw new PhutilMethodNotImplementedException();
+ }
/**
* Finalizes any cleanup operations that need to occur regardless of
@@ -99,17 +142,21 @@
*
* @return string 6-space indented list of available command synopses.
*/
- abstract public function getCommandSynopses();
+ public function getCommandSynopses() {
+ return array();
+ }
/**
* Return console formatted string with command help printed in `arc help`.
*
* @return string 10-space indented help to use the command.
*/
- abstract public function getCommandHelp();
+ public function getCommandHelp() {
+ return null;
+ }
- final public function supportsToolset($toolset) {
- return ($toolset === 'arc');
+ public function supportsToolset(ArcanistToolset $toolset) {
+ return false;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 9:25 AM (4 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7652810
Default Alt Text
D20991.id50017.diff (11 KB)
Attached To
Mode
D20991: Port "arc help" to Toolsets
Attached
Detach File
Event Timeline
Log In to Comment