1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-29 17:00:58 +01:00

arc set-config: warn about unknown keys

Summary: See T12266. Warn when the user tries to set a value we will probably not read.

Test Plan: `arc set-config foo bar`, see fancy warning.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D17357
This commit is contained in:
Aviv Eyal 2017-02-15 13:38:57 +00:00 committed by avivey
parent f3037bf216
commit bc9b70508e

View file

@ -69,6 +69,16 @@ EOTEXT
$settings = new ArcanistSettings();
$console = PhutilConsole::getConsole();
if (!$settings->getHelp($key)) {
$warn = pht(
'The configuration key \'%s\' is not recognized by arc. It may '.
'be misspelled or out of date.',
$key);
$console->writeErr("**%s:** %s\n", pht('Warning'), $warn);
}
$old = null;
if (array_key_exists($key, $config)) {
$old = $config[$key];
@ -85,12 +95,12 @@ EOTEXT
$old = $settings->formatConfigValueForDisplay($key, $old);
if ($old === null) {
echo pht(
$console->writeOut(
"Deleted key '%s' from %s config.\n",
$key,
$which);
} else {
echo pht(
$console->writeOut(
"Deleted key '%s' from %s config (was %s).\n",
$key,
$which,
@ -110,13 +120,13 @@ EOTEXT
$old = $settings->formatConfigValueForDisplay($key, $old);
if ($old === null) {
echo pht(
$console->writeOut(
"Set key '%s' = %s in %s config.\n",
$key,
$val,
$which);
} else {
echo pht(
$console->writeOut(
"Set key '%s' = %s in %s config (was %s).\n",
$key,
$val,