mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +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:
parent
f3037bf216
commit
bc9b70508e
1 changed files with 14 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue