1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-10-30 23:37:45 +02:00

Allow internal options that do not show up in the documentation.

Used for test options initially but other use cases are on the horizon.
This commit is contained in:
David Steele
2017-12-05 14:46:52 -05:00
parent 8d4674031e
commit 5eb5d94d65
3 changed files with 21 additions and 3 deletions

View File

@@ -41,6 +41,10 @@
#
# CFGDEF_ALLOW_LIST:
# Lists the allowable settings for the option.
#
# CFGDEF_INTERNAL:
# Option is used by the command internally but is not exposed in the documentation. This is useful for commands that need to know
# where they are running by looking at other options in the config. Also good for test options.
####################################################################################################################################
package pgBackRestBuild::Config::Data;
@@ -423,6 +427,8 @@ use constant CFGDEF_INDEX => 'index';
push @EXPORT, qw(CFGDEF_INDEX);
use constant CFGDEF_INDEX_TOTAL => 'indexTotal';
push @EXPORT, qw(CFGDEF_INDEX_TOTAL);
use constant CFGDEF_INTERNAL => 'internal';
push @EXPORT, qw(CFGDEF_INTERNAL);
use constant CFGDEF_NEGATE => 'negate';
push @EXPORT, qw(CFGDEF_NEGATE);
use constant CFGDEF_PREFIX => 'prefix';
@@ -798,6 +804,7 @@ my %hConfigDefine =
&CFGOPT_TEST =>
{
&CFGDEF_TYPE => CFGDEF_TYPE_BOOLEAN,
&CFGDEF_INTERNAL => true,
&CFGDEF_DEFAULT => false,
&CFGDEF_COMMAND =>
{
@@ -809,6 +816,7 @@ my %hConfigDefine =
&CFGOPT_TEST_DELAY =>
{
&CFGDEF_TYPE => CFGDEF_TYPE_FLOAT,
&CFGDEF_INTERNAL => true,
&CFGDEF_DEFAULT => 5,
&CFGDEF_DEPEND =>
{
@@ -821,6 +829,7 @@ my %hConfigDefine =
&CFGOPT_TEST_POINT =>
{
&CFGDEF_TYPE => CFGDEF_TYPE_HASH,
&CFGDEF_INTERNAL => true,
&CFGDEF_REQUIRED => false,
&CFGDEF_DEPEND => CFGOPT_TEST_DELAY,
&CFGDEF_COMMAND => CFGOPT_TEST,
@@ -1857,8 +1866,10 @@ foreach my $strKey (sort(keys(%hConfigDefine)))
$hConfigDefine{$strKey}{&CFGDEF_REQUIRED} = true;
}
if (!defined($hConfigDefine{$strKey}{&CFGDEF_INDEX}))
# Default internal is false
if (!defined($hConfigDefine{$strKey}{&CFGDEF_INTERNAL}))
{
$hConfigDefine{$strKey}{&CFGDEF_INTERNAL} = false;
}
# Set index total for db-*

View File

@@ -209,8 +209,8 @@ sub process
foreach my $strOption (sort(keys(%{$oOptionDefine})))
{
# Test options are not documented
next if ($strOption =~ /^test/);
# Skip options that are internal only for all commands (test options)
next if $oOptionDefine->{$strOption}{&CFGDEF_INTERNAL};
# Iterate through all commands
my @stryCommandList = sort(keys(%{defined($$oOptionDefine{$strOption}{&CFGDEF_COMMAND}) ?
@@ -229,6 +229,9 @@ sub process
next;
}
# Skip options that are internal only for the current command
next if $oOptionDefine->{$strOption}{&CFGDEF_COMMAND}{$strCommand}{&CFGDEF_INTERNAL};
my $oCommandDoc = $oDoc->nodeGet('operation')->nodeGet('command-list')->nodeGetById('command', $strCommand);
# First check if the option is documented in the command

View File

@@ -74,6 +74,10 @@
<release-item>
<p>Add coding standards document.</p>
</release-item>
<release-item>
<p>Allow internal options that do not show up in the documentation. Used for test options initially but other use cases are on the horizon.</p>
</release-item>
</release-development-list>
</release-doc-list>