diff --git a/scripts/arcanist.php b/scripts/arcanist.php --- a/scripts/arcanist.php +++ b/scripts/arcanist.php @@ -165,6 +165,7 @@ $workflow->setCommand($command); $workflow->setWorkingDirectory($working_directory); $workflow->parseArguments($args); + $workflow->applyRuntimeConfiguration(); // Write the command into the environment so that scripts (for example, local // Git commit hooks) can detect that they're being run via `arc` and change diff --git a/src/workflow/ArcanistBaseWorkflow.php b/src/workflow/ArcanistBaseWorkflow.php --- a/src/workflow/ArcanistBaseWorkflow.php +++ b/src/workflow/ArcanistBaseWorkflow.php @@ -594,9 +594,32 @@ $arc_config = $this->getArcanistConfiguration(); $command = $this->getCommand(); $spec += $arc_config->getCustomArgumentsForCommand($command); + $spec += $this->getGlobalArguments(); + return $spec; } + final function getGlobalArguments() { + return array( + 'config' => array( + 'param' => 'key=value', + 'repeat' => true, + 'help' => + 'Specify a configuration value for the duration of this command', + ), + ); + } + + final public function applyRuntimeConfiguration() { + $options = $this->getArgument('config'); + $manager = $this->getConfigurationManager(); + + foreach ($options as $opt) { + list($key, $value) = preg_split('/=/', $opt, 2); + $manager->setRuntimeConfig($key, $value); + } + } + final public function parseArguments(array $args) { $this->passedArguments = $args; diff --git a/src/workflow/ArcanistHelpWorkflow.php b/src/workflow/ArcanistHelpWorkflow.php --- a/src/workflow/ArcanistHelpWorkflow.php +++ b/src/workflow/ArcanistHelpWorkflow.php @@ -63,6 +63,7 @@ } $optref = array(); $arguments = $workflow->getArguments(); + $arguments += $workflow->getGlobalArguments(); $config_arguments = $arc_config->getCustomArgumentsForCommand($command);