Page MenuHomePhabricator

D9442.id22780.diff
No OneTemporary

D9442.id22780.diff

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
@@ -606,9 +606,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);

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 12:48 PM (20 h, 47 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6785936
Default Alt Text
D9442.id22780.diff (1 KB)

Event Timeline