Differential D9431 Diff 22523 src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
| Show All 16 Lines | $this | ||||
| )); | )); | ||||
| } | } | ||||
| public function execute(PhutilArgumentParser $args) { | public function execute(PhutilArgumentParser $args) { | ||||
| $console = PhutilConsole::getConsole(); | $console = PhutilConsole::getConsole(); | ||||
| $argv = $args->getArg('args'); | $argv = $args->getArg('args'); | ||||
| if (count($argv) == 0) { | if (count($argv) == 0) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| "Specify a configuration key and a value to set it to."); | 'Specify a configuration key and a value to set it to.'); | ||||
| } | } | ||||
| $key = $argv[0]; | $key = $argv[0]; | ||||
| if (count($argv) == 1) { | if (count($argv) == 1) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| "Specify a value to set the key '{$key}' to."); | "Specify a value to set the key '{$key}' to."); | ||||
| } | } | ||||
| $value = $argv[1]; | $value = $argv[1]; | ||||
| if (count($argv) > 2) { | if (count($argv) > 2) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| "Too many arguments: expected one key and one value."); | 'Too many arguments: expected one key and one value.'); | ||||
| } | } | ||||
| $options = PhabricatorApplicationConfigOptions::loadAllOptions(); | $options = PhabricatorApplicationConfigOptions::loadAllOptions(); | ||||
| if (empty($options[$key])) { | if (empty($options[$key])) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| "No such configuration key '{$key}'! Use `config list` to list all ". | "No such configuration key '{$key}'! Use `config list` to list all ". | ||||
| "keys."); | "keys."); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines | |||||