Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistSetConfigWorkflow.php
| Show All 30 Lines | return phutil_console_format(<<<EOTEXT | ||||
| directory under either .git, .hg, or .svn as appropriate. | directory under either .git, .hg, or .svn as appropriate. | ||||
| EOTEXT | EOTEXT | ||||
| ); | ); | ||||
| } | } | ||||
| public function getArguments() { | public function getArguments() { | ||||
| return array( | return array( | ||||
| 'local' => array( | 'local' => array( | ||||
| 'help' => 'Set a local config value instead of a user one', | 'help' => pht('Set a local config value instead of a user one.'), | ||||
| ), | ), | ||||
| '*' => 'argv', | '*' => 'argv', | ||||
| ); | ); | ||||
| } | } | ||||
| public function requiresRepositoryAPI() { | public function requiresRepositoryAPI() { | ||||
| return $this->getArgument('local'); | return $this->getArgument('local'); | ||||
| } | } | ||||
| Show All 32 Lines | if (!strlen($val)) { | ||||
| $configuration_manager->writeLocalArcConfig($config); | $configuration_manager->writeLocalArcConfig($config); | ||||
| } else { | } else { | ||||
| $configuration_manager->writeUserArcConfig($config); | $configuration_manager->writeUserArcConfig($config); | ||||
| } | } | ||||
| $old = $settings->formatConfigValueForDisplay($key, $old); | $old = $settings->formatConfigValueForDisplay($key, $old); | ||||
| if ($old === null) { | if ($old === null) { | ||||
| echo "Deleted key '{$key}' from {$which} config.\n"; | echo pht( | ||||
| } else { | "Deleted key '%s' from %s config.\n", | ||||
| echo "Deleted key '{$key}' from {$which} config (was {$old}).\n"; | $key, | ||||
| $which); | |||||
| } else { | |||||
| echo pht( | |||||
| "Deleted key '%s' from %s config (was %s).\n", | |||||
| $key, | |||||
| $which, | |||||
| $old); | |||||
| } | } | ||||
| } else { | } else { | ||||
| $val = $settings->willWriteValue($key, $val); | $val = $settings->willWriteValue($key, $val); | ||||
| $config[$key] = $val; | $config[$key] = $val; | ||||
| if ($is_local) { | if ($is_local) { | ||||
| $configuration_manager->writeLocalArcConfig($config); | $configuration_manager->writeLocalArcConfig($config); | ||||
| } else { | } else { | ||||
| $configuration_manager->writeUserArcConfig($config); | $configuration_manager->writeUserArcConfig($config); | ||||
| } | } | ||||
| $val = $settings->formatConfigValueForDisplay($key, $val); | $val = $settings->formatConfigValueForDisplay($key, $val); | ||||
| $old = $settings->formatConfigValueForDisplay($key, $old); | $old = $settings->formatConfigValueForDisplay($key, $old); | ||||
| if ($old === null) { | if ($old === null) { | ||||
| echo "Set key '{$key}' = {$val} in {$which} config.\n"; | echo pht( | ||||
| } else { | "Set key '%s' = %s in %s config.\n", | ||||
| echo "Set key '{$key}' = {$val} in {$which} config (was {$old}).\n"; | $key, | ||||
| $val, | |||||
| $which); | |||||
| } else { | |||||
| echo pht( | |||||
| "Set key '%s' = %s in %s config (was %s).\n", | |||||
| $key, | |||||
| $val, | |||||
| $which, | |||||
| $old); | |||||
| } | } | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||