Differential D9431 Diff 22523 src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php
| Show All 17 Lines | final class PhabricatorConfigManagementDeleteWorkflow | ||||
| } | } | ||||
| 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 to delete."); | 'Specify a configuration key to delete.'); | ||||
| } | } | ||||
| $key = $argv[0]; | $key = $argv[0]; | ||||
| if (count($argv) > 1) { | if (count($argv) > 1) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| "Too many arguments: expected one key."); | 'Too many arguments: expected one key.'); | ||||
| } | } | ||||
| $config = new PhabricatorConfigLocalSource(); | $config = new PhabricatorConfigLocalSource(); | ||||
| $values = $config->getKeys(array($key)); | $values = $config->getKeys(array($key)); | ||||
| if (!$values) { | if (!$values) { | ||||
| throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
| "Configuration key '{$key}' is not set in local configuration!"); | "Configuration key '{$key}' is not set in local configuration!"); | ||||
| } | } | ||||
| $config->deleteKeys(array($key)); | $config->deleteKeys(array($key)); | ||||
| $console->writeOut( | $console->writeOut( | ||||
| pht("Deleted '%s' from local configuration.", $key)."\n"); | pht("Deleted '%s' from local configuration.", $key)."\n"); | ||||
| } | } | ||||
| } | } | ||||