1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 00:28:52 +02:00

Add cfgOptionDisplay()/cfgOptionIdxDisplay().

Centralize the formatting of the configuration value for display to the user or passing on a command line.

For the new functions, if the value was set by the user via the command line, config, etc., then that exact value will be displayed. This makes it easier for the user to recognize the value and saves having to format it into something reasonable, especially for time and size option types.

Note that cfgOptTypeHash and cfgOptTypeList option types are not supported by these functions, but they are generally not displayed to the user as a whole.

This also fixes a bug in config/load.c where time values where not being formatted correctly in an error message.
This commit is contained in:
David Steele
2021-04-27 12:12:43 -04:00
committed by GitHub
parent 95fb002b85
commit 1edcfde93e
24 changed files with 158 additions and 53 deletions

View File

@ -126,17 +126,11 @@ cmdOption(void)
{
valueList = strLstNewVarLst(cfgOptionIdxLst(optionId, optionIdx));
}
// Generate time value
else if (cfgParseOptionType(optionId) == cfgOptTypeTime)
{
valueList = strLstNew();
strLstAdd(valueList, strNewDbl((double)cfgOptionIdxInt64(optionId, optionIdx) / MSEC_PER_SEC));
}
// Else only one value
else
{
valueList = strLstNew();
strLstAdd(valueList, varStrForce(cfgOptionIdx(optionId, optionIdx)));
strLstAdd(valueList, cfgOptionIdxDisplay(optionId, optionIdx));
}
// Output options and values