Changeset View
Changeset View
Standalone View
Standalone View
src/toolset/workflow/ArcanistSetConfigWorkflow.php
- This file was moved from src/workflow/ArcanistSetConfigWorkflow.php.
| <?php | <?php | ||||
| /** | /** | ||||
| * Write configuration settings. | * Write configuration settings. | ||||
| */ | */ | ||||
| final class ArcanistSetConfigWorkflow extends ArcanistWorkflow { | final class ArcanistSetConfigWorkflow extends ArcanistWorkflow { | ||||
| public function supportsToolset(ArcanistToolset $toolset) { | |||||
| return true; | |||||
| } | |||||
| public function getWorkflowName() { | public function getWorkflowName() { | ||||
| return 'set-config'; | return 'set-config'; | ||||
| } | } | ||||
| public function getCommandSynopses() { | public function getWorkflowInformation() { | ||||
| return phutil_console_format(<<<EOTEXT | $help = pht(<<<EOTEXT | ||||
| **set-config** [__options__] -- __name__ __value__ | Write a configuration setting. | ||||
| Options are either user (apply to all arc commands you invoke from the current | |||||
| user) or local (apply only to the current working copy). By default, user | |||||
| configuration is written. Use __--local__ to write local configuration. | |||||
| User values are written to '~/.arcrc' on Linux and Mac OS X, and an undisclosed | |||||
| location on Windows. Local values are written to an arc directory under | |||||
| either .git, .hg, or .svn as appropriate. | |||||
| EOTEXT | EOTEXT | ||||
| ); | ); | ||||
| } | |||||
| public function getCommandHelp() { | return $this->newWorkflowInformation() | ||||
| return phutil_console_format(<<<EOTEXT | ->addExample('**set-config** [__options__] -- __name__ __value__') | ||||
| Supports: cli | ->setHelp($help); | ||||
| Sets an arc configuration option. | |||||
| Options are either user (apply to all arc commands you invoke | |||||
| from the current user) or local (apply only to the current working | |||||
| copy). By default, user configuration is written. Use __--local__ | |||||
| to write local configuration. | |||||
| User values are written to '~/.arcrc' on Linux and Mac OS X, and an | |||||
| undisclosed location on Windows. Local values are written to an arc | |||||
| directory under either .git, .hg, or .svn as appropriate. | |||||
| EOTEXT | |||||
| ); | |||||
| } | } | ||||
| public function getArguments() { | public function getWorkflowArguments() { | ||||
| return array( | return array( | ||||
| 'local' => array( | $this->newWorkflowArgument('local') | ||||
| 'help' => pht('Set a local config value instead of a user one.'), | ->setHelp( | ||||
| ), | pht( | ||||
| '*' => 'argv', | 'Write to local storage (in the current working copy) instead '. | ||||
| 'of user storage (in your home directory).')), | |||||
| $this->newWorkflowArgument('argv') | |||||
| ->setWildcard(true), | |||||
| ); | ); | ||||
| } | } | ||||
| public function requiresRepositoryAPI() { | public function requiresRepositoryAPI() { | ||||
| return $this->getArgument('local'); | return $this->getArgument('local'); | ||||
| } | } | ||||
| public function run() { | public function runWorkflow() { | ||||
| $argv = $this->getArgument('argv'); | $argv = $this->getArgument('argv'); | ||||
| if (count($argv) != 2) { | if (count($argv) != 2) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| pht('Specify a key and a value.')); | pht('Specify a key and a value.')); | ||||
| } | } | ||||
| $configuration_manager = $this->getConfigurationManager(); | $configuration_manager = $this->getConfigurationManager(); | ||||
| $is_local = $this->getArgument('local'); | $is_local = $this->getArgument('local'); | ||||
| ▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines | |||||