You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-13 01:00:23 +02:00
Move all parse-related rules to parse module.
Data required for parsing was spread between the config and defined modules, mostly for historical reasons because the same data was used by Perl. Requiring all the parse rules to be accessed with function interfaces makes the code more complicated and new rules harder to implement. Instead, move the data to the parse module so in the most complex cases no interface functions are needed. This reduces the total amount of code and paves the way for more complex parse rules.
This commit is contained in:
@ -13,7 +13,7 @@ Common Command Routines
|
||||
#include "common/time.h"
|
||||
#include "common/type/json.h"
|
||||
#include "config/config.intern.h"
|
||||
#include "config/define.h"
|
||||
#include "config/parse.h"
|
||||
#include "version.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
@ -76,7 +76,7 @@ cmdOption(void)
|
||||
// Skip the option if not valid for this command. Generally only one command runs at a time, but sometimes
|
||||
// commands are chained together (e.g. backup and expire) and the second command may not use all the options of
|
||||
// the first command. Displaying them is harmless but might cause confusion.
|
||||
if (!cfgOptionValid(optionId) || !cfgDefOptionValid(cfgCommand(), optionId))
|
||||
if (!cfgOptionValid(optionId) || !cfgParseOptionValid(cfgCommand(), optionId))
|
||||
continue;
|
||||
|
||||
// Loop through option indexes
|
||||
@ -94,10 +94,10 @@ cmdOption(void)
|
||||
else if (cfgOptionIdxSource(optionId, optionIdx) != cfgSourceDefault)
|
||||
{
|
||||
// Don't show redacted options
|
||||
if (cfgDefOptionSecure(optionId))
|
||||
if (cfgParseOptionSecure(optionId))
|
||||
strCatFmt(cmdOptionStr, " --%s=<redacted>", cfgOptionIdxName(optionId, optionIdx));
|
||||
// Output boolean option
|
||||
else if (cfgDefOptionType(optionId) == cfgDefOptTypeBoolean)
|
||||
else if (cfgParseOptionType(optionId) == cfgOptTypeBoolean)
|
||||
strCatFmt(cmdOptionStr, " --%s", cfgOptionIdxName(optionId, optionIdx));
|
||||
// Output other options
|
||||
else
|
||||
@ -105,7 +105,7 @@ cmdOption(void)
|
||||
StringList *valueList = NULL;
|
||||
|
||||
// Generate the values of hash options
|
||||
if (cfgDefOptionType(optionId) == cfgDefOptTypeHash)
|
||||
if (cfgParseOptionType(optionId) == cfgOptTypeHash)
|
||||
{
|
||||
valueList = strLstNew();
|
||||
|
||||
@ -122,12 +122,12 @@ cmdOption(void)
|
||||
}
|
||||
}
|
||||
// Generate values for list options
|
||||
else if (cfgDefOptionType(optionId) == cfgDefOptTypeList)
|
||||
else if (cfgParseOptionType(optionId) == cfgOptTypeList)
|
||||
{
|
||||
valueList = strLstNewVarLst(cfgOptionIdxLst(optionId, optionIdx));
|
||||
}
|
||||
// Generate time value
|
||||
else if (cfgDefOptionType(optionId) == cfgDefOptTypeTime)
|
||||
else if (cfgParseOptionType(optionId) == cfgOptTypeTime)
|
||||
{
|
||||
valueList = strLstNew();
|
||||
strLstAdd(
|
||||
|
Reference in New Issue
Block a user