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

Add help for all internal options valid for default roles.

Fix the segfault when getting help for an internal option is requested by adding help for all internal options that are valid for a default command role.

Also print warnings about internal options in code rather than putting in each command/option description.
This commit is contained in:
David Steele
2021-04-23 11:46:03 -04:00
committed by GitHub
parent 2ad497ea4c
commit aaa15b9709
6 changed files with 238 additions and 62 deletions

View File

@ -212,9 +212,6 @@ sub process
foreach my $strOption (sort(keys(%{$oOptionDefine})))
{
# 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}) ?
$$oOptionDefine{$strOption}{&CFGDEF_COMMAND} : $$oConfigHash{&CONFIG_HELP_COMMAND}}));
@ -233,9 +230,6 @@ 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
@ -286,6 +280,8 @@ sub process
# If a section is specified then use it, otherwise the option should be general since it is not for a specific
# command
if (defined($oOptionDoc))
{
$strSection = $oOptionDoc->paramGet('section', false);
if (!defined($strSection))
@ -294,6 +290,7 @@ sub process
}
}
}
}
# If the option wasn't found then error
if (!defined($oOptionDoc))
@ -321,6 +318,8 @@ sub process
$$oCommandOption{&CONFIG_HELP_SUMMARY} = $oOptionDoc->nodeGet('summary')->textGet();
$$oCommandOption{&CONFIG_HELP_DESCRIPTION} = $oOptionDoc->textGet();
$$oCommandOption{&CONFIG_HELP_EXAMPLE} = $oOptionDoc->fieldGet('example');
$oCommandOption->{&CONFIG_HELP_INTERNAL} =
cfgDefineCommand()->{$strCommand}{&CFGDEF_INTERNAL} ? true : $oOptionDefine->{$strOption}{&CFGDEF_INTERNAL};
$$oCommandOption{&CONFIG_HELP_NAME} = $oOptionDoc->paramGet('name');
@ -364,6 +363,7 @@ sub process
$oOption->{&CONFIG_HELP_NAME_ALT} = $oCommandOption->{&CONFIG_HELP_NAME_ALT};
$$oOption{&CONFIG_HELP_DESCRIPTION} = $$oCommandOption{&CONFIG_HELP_DESCRIPTION};
$$oOption{&CONFIG_HELP_EXAMPLE} = $oOptionDoc->fieldGet('example');
$oOption->{&CONFIG_HELP_INTERNAL} = $oOptionDefine->{$strOption}{&CFGDEF_INTERNAL};
}
}
}
@ -456,6 +456,9 @@ sub manGet
foreach my $strOption (sort(keys(%{$$hConfig{&CONFIG_HELP_OPTION}})))
{
# Skip internal options
next if $hConfig->{&CONFIG_HELP_OPTION}{$strOption}{&CONFIG_HELP_INTERNAL};
my $hOption = $$hConfig{&CONFIG_HELP_OPTION}{$strOption};
$iOptionMaxLen = length($strOption) > $iOptionMaxLen ? length($strOption) : $iOptionMaxLen;
my $strSection = defined($$hOption{&CONFIG_HELP_SECTION}) ? $$hOption{&CONFIG_HELP_SECTION} : CFGDEF_GENERAL;
@ -642,6 +645,9 @@ sub helpConfigDocGet
foreach my $strOption (sort(keys(%{$$oSectionHash{$strSection}})))
{
# Skip internal options
next if $oConfigHash->{&CONFIG_HELP_OPTION}{$strOption}{&CONFIG_HELP_INTERNAL};
$self->helpOptionGet(undef, $strOption, $oSectionElement, $$oConfigHash{&CONFIG_HELP_OPTION}{$strOption});
}
}
@ -708,6 +714,9 @@ sub helpCommandDocGet
foreach my $strOption (sort(keys(%{$$oCommandHash{&CONFIG_HELP_OPTION}})))
{
# Skip internal options
next if $rhConfigDefine->{$strOption}{&CFGDEF_INTERNAL};
# Skip secure options that can't be defined on the command line
next if ($rhConfigDefine->{$strOption}{&CFGDEF_SECURE});

View File

@ -210,6 +210,24 @@
<example>120</example>
</config-key>
<!-- ======================================================================================================= -->
<config-key id="job-retry" name="Job Retry Count">
<summary>Retry count for local jobs.</summary>
<text>The number of retries for jobs run in the local process, e.g. file backup.</text>
<example>5</example>
</config-key>
<!-- ======================================================================================================= -->
<config-key id="job-retry-interval" name="Job Retry Interval">
<summary>Retry interval after first retry.</summary>
<text>The first retry is always performed immediately. This option specifies the interval to wait (in seconds) before performing each additional retry.</text>
<example>30</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - LOCK-PATH KEY -->
<config-key id="lock-path" name="Lock Path">
<summary>Path where lock files are stored.</summary>
@ -265,6 +283,15 @@
<example>630</example>
</config-key>
<!-- ======================================================================================================= -->
<config-key id="sck-block" name="Socket Blocking">
<summary>Socket blocking enable.</summary>
<text>Enable blocking on socket connections.</text>
<example>y</example>
</config-key>
<!-- CONFIG - GENERAL SECTION - SCK-KEEP-ALIVE KEY -->
<config-key id="sck-keep-alive" name="Keep Alive">
<summary>Keep-alive enable.</summary>
@ -488,6 +515,15 @@
<example>y</example>
</config-key>
<!-- ======================================================================================================= -->
<config-key id="repo-local" name="Repository Locality">
<summary>Repository is local.</summary>
<text>Indicates that the repository for the specified index is local and any repository host settings for that index (e.g. <setting>repo1-host</setting>) should be ignored.</text>
<example>y</example>
</config-key>
<!-- CONFIG - REPO SECTION - REPO-PATH KEY -->
<config-key id="repo-path" name="Repository Path">
<summary>Path where backups and archive are stored.</summary>
@ -1096,6 +1132,15 @@
<example>backupdb</example>
</config-key>
<!-- ======================================================================================================= -->
<config-key id="pg-local" name="PostgreSQL Locality">
<summary><postgres/> is local.</summary>
<text>Indicates that <postgres/> for the specified index is local and any <postgres/> host settings for that index (e.g. <setting>pg1-host</setting>) should be ignored.</text>
<example>y</example>
</config-key>
<!-- CONFIG - STANZA SECTION - PG-PATH KEY -->
<config-key id="pg-path" name="PostgreSQL Path">
<summary><postgres/> data directory.</summary>
@ -1167,9 +1212,7 @@
<option id="cipher-pass" name="Ad Hoc Cipher Passphrase">
<summary>Cipher passphrase for current command.</summary>
<text>Specify an ad hoc cipher passphrase for the current command.
<b>FOR INTERNAL USE ONLY. DO NOT USE ON A PRODUCTION REPOSITORY.</b></text>
<text>Specify an ad hoc cipher passphrase for the current command.</text>
<example>zWaf6XtpjIVZC5444yXB+cgFDFl7MxGlgkZSaoPvTGirhPygu4jOKOXf9LO4vjfO</example>
</option>
@ -1212,6 +1255,17 @@
<example>y</example>
</option>
<!-- =========================================================================================================== -->
<option id="exec-id" name="Execution Identifier">
<summary>Unique identifier for the process.</summary>
<text>A locally unique identifier used to identify a process when resolving locks on a remote host.
The <setting>exec-id</setting> option is generated automatically when needed but it is possible to set it explicitly, which saves a bit of time at startup but introduces the problem of selecting a unique value.</text>
<example>y</example>
</option>
<!-- OPERATION - GENERAL - RAW -->
<option id="raw" name="Raw Data">
<summary>Do not transform data.</summary>
@ -1348,9 +1402,7 @@
<command id="repo-create" name="Create Repository">
<summary>Create the repository.</summary>
<text>Create the repository (path, bucket, etc.) on the default repository. If more than one repository is configured, the command will default to the highest priority repository (e.g. <id>repo1</id>) unless the <br-option>{[dash]}-repo</br-option> option is specified. If <setting>repo-type=s3</setting> the bucket will be created.
<b>FOR INTERNAL USE ONLY. DO NOT USE ON A PRODUCTION REPOSITORY.</b></text>
<text>Create the repository (path, bucket, etc.) on the default repository. If more than one repository is configured, the command will default to the highest priority repository (e.g. <id>repo1</id>) unless the <br-option>{[dash]}-repo</br-option> option is specified. If <setting>repo-type=s3</setting> the bucket will be created.</text>
</command>
@ -1447,9 +1499,7 @@
<text>Similar to the unix <cmd>tee</cmd> command by copying from stdin to a file but options and behavior are different. This command requires a fully qualified file name and is primarily for administration, investigation, and testing. It is not a required part of a normal <backrest/> setup.
If more than one repository is configured, the command will default to the highest priority repository (e.g. <id>repo1</id>) unless the <br-option>{[dash]}-repo</br-option> option is specified.
<b>FOR INTERNAL USE ONLY. DO NOT USE ON A PRODUCTION REPOSITORY.</b></text>
If more than one repository is configured, the command will default to the highest priority repository (e.g. <id>repo1</id>) unless the <br-option>{[dash]}-repo</br-option> option is specified.</text>
</command>
<!-- OPERATION - REPO-RM COMMAND -->
@ -1458,9 +1508,7 @@
<text>Similar to the unix <cmd>rm</cmd> command but options are different. This command accepts a path, absolute or relative to the repository path defined by the <br-option>{[dash]}-repo-path</br-option> option, and is primarily for administration, investigation, and testing. It is not a required part of a normal <backrest/> setup.
If more than one repository is configured, the command will default to the highest priority repository (e.g. <id>repo1</id>) unless the <br-option>{[dash]}-repo</br-option> option is specified.
<b>FOR INTERNAL USE ONLY. DO NOT USE ON A PRODUCTION REPOSITORY.</b></text>
If more than one repository is configured, the command will default to the highest priority repository (e.g. <id>repo1</id>) unless the <br-option>{[dash]}-repo</br-option> option is specified.</text>
<option-list>
<!-- OPERATION - REPO-RM COMMAND - RECURSE OPTION -->

View File

@ -55,6 +55,19 @@
</release-improvement-list>
<release-development-list>
<release-item>
<github-pull-request id="1377"/>
<release-item-contributor-list>
<release-item-ideator id="cynthia.shang"/>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="cynthia.shang"/>
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p>Add help for all internal options valid for default roles.</p>
</release-item>
<release-item>
<github-pull-request id="1358"/>

View File

@ -440,7 +440,7 @@ static const unsigned char helpDataPack[] =
pckTypeStr << 4 | 0x08, 0x16, // Summary
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72,
0x79, 0x2E,
pckTypeStr << 4 | 0x08, 0xCB, 0x02, // Description
pckTypeStr << 4 | 0x08, 0x8C, 0x02, // Description
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72,
0x79, 0x20, 0x28, 0x70, 0x61, 0x74, 0x68, 0x2C, 0x20, 0x62, 0x75, 0x63, 0x6B, 0x65, 0x74, 0x2C, 0x20, 0x65, 0x74, 0x63,
0x2E, 0x29, 0x20, 0x6F, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6C, 0x74, 0x20, 0x72, 0x65,
@ -454,11 +454,7 @@ static const unsigned char helpDataPack[] =
0x65, 0x70, 0x6F, 0x20, 0x6F, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66,
0x69, 0x65, 0x64, 0x2E, 0x20, 0x49, 0x66, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x2D, 0x74, 0x79, 0x70, 0x65, 0x3D, 0x73, 0x33,
0x20, 0x74, 0x68, 0x65, 0x20, 0x62, 0x75, 0x63, 0x6B, 0x65, 0x74, 0x20, 0x77, 0x69, 0x6C, 0x6C, 0x20, 0x62, 0x65, 0x20,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x2E, 0x0A, 0x0A,
0x46, 0x4F, 0x52, 0x20, 0x49, 0x4E, 0x54, 0x45, 0x52, 0x4E, 0x41, 0x4C, 0x20, 0x55, 0x53, 0x45, 0x20, 0x4F, 0x4E, 0x4C,
0x59, 0x2E, 0x20, 0x44, 0x4F, 0x20, 0x4E, 0x4F, 0x54, 0x20, 0x55, 0x53, 0x45, 0x20, 0x4F, 0x4E, 0x20, 0x41, 0x20, 0x50,
0x52, 0x4F, 0x44, 0x55, 0x43, 0x54, 0x49, 0x4F, 0x4E, 0x20, 0x52, 0x45, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x4F, 0x52, 0x59,
0x2E,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x2E,
// repo-get command
// -------------------------------------------------------------------------------------------------------------------------
@ -542,7 +538,7 @@ static const unsigned char helpDataPack[] =
pckTypeStr << 4 | 0x08, 0x1D, // Summary
0x50, 0x75, 0x74, 0x20, 0x61, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x20, 0x69, 0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65,
0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x2E,
pckTypeStr << 4 | 0x08, 0xED, 0x03, // Description
pckTypeStr << 4 | 0x08, 0xAE, 0x03, // Description
0x53, 0x69, 0x6D, 0x69, 0x6C, 0x61, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6E, 0x69, 0x78, 0x20,
0x74, 0x65, 0x65, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x62, 0x79, 0x20, 0x63, 0x6F, 0x70, 0x79, 0x69,
0x6E, 0x67, 0x20, 0x66, 0x72, 0x6F, 0x6D, 0x20, 0x73, 0x74, 0x64, 0x69, 0x6E, 0x20, 0x74, 0x6F, 0x20, 0x61, 0x20, 0x66,
@ -564,11 +560,7 @@ static const unsigned char helpDataPack[] =
0x73, 0x74, 0x20, 0x70, 0x72, 0x69, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F,
0x72, 0x79, 0x20, 0x28, 0x65, 0x2E, 0x67, 0x2E, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x31, 0x29, 0x20, 0x75, 0x6E, 0x6C, 0x65,
0x73, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2D, 0x2D, 0x72, 0x65, 0x70, 0x6F, 0x20, 0x6F, 0x70, 0x74, 0x69, 0x6F, 0x6E,
0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2E, 0x0A, 0x0A,
0x46, 0x4F, 0x52, 0x20, 0x49, 0x4E, 0x54, 0x45, 0x52, 0x4E, 0x41, 0x4C, 0x20, 0x55, 0x53, 0x45, 0x20, 0x4F, 0x4E, 0x4C,
0x59, 0x2E, 0x20, 0x44, 0x4F, 0x20, 0x4E, 0x4F, 0x54, 0x20, 0x55, 0x53, 0x45, 0x20, 0x4F, 0x4E, 0x20, 0x41, 0x20, 0x50,
0x52, 0x4F, 0x44, 0x55, 0x43, 0x54, 0x49, 0x4F, 0x4E, 0x20, 0x52, 0x45, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x4F, 0x52, 0x59,
0x2E,
0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2E,
// repo-rm command
// -------------------------------------------------------------------------------------------------------------------------
@ -576,7 +568,7 @@ static const unsigned char helpDataPack[] =
pckTypeStr << 4 | 0x08, 0x25, // Summary
0x52, 0x65, 0x6D, 0x6F, 0x76, 0x65, 0x20, 0x70, 0x61, 0x74, 0x68, 0x73, 0x2F, 0x66, 0x69, 0x6C, 0x65, 0x73, 0x20, 0x69,
0x6E, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x2E,
pckTypeStr << 4 | 0x08, 0xF9, 0x03, // Description
pckTypeStr << 4 | 0x08, 0xBA, 0x03, // Description
0x53, 0x69, 0x6D, 0x69, 0x6C, 0x61, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x74, 0x68, 0x65, 0x20, 0x75, 0x6E, 0x69, 0x78, 0x20,
0x72, 0x6D, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x20, 0x62, 0x75, 0x74, 0x20, 0x6F, 0x70, 0x74, 0x69, 0x6F,
0x6E, 0x73, 0x20, 0x61, 0x72, 0x65, 0x20, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6E, 0x74, 0x2E, 0x20, 0x54, 0x68,
@ -599,11 +591,7 @@ static const unsigned char helpDataPack[] =
0x73, 0x74, 0x20, 0x70, 0x72, 0x69, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F,
0x72, 0x79, 0x20, 0x28, 0x65, 0x2E, 0x67, 0x2E, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x31, 0x29, 0x20, 0x75, 0x6E, 0x6C, 0x65,
0x73, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x2D, 0x2D, 0x72, 0x65, 0x70, 0x6F, 0x20, 0x6F, 0x70, 0x74, 0x69, 0x6F, 0x6E,
0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2E, 0x0A, 0x0A,
0x46, 0x4F, 0x52, 0x20, 0x49, 0x4E, 0x54, 0x45, 0x52, 0x4E, 0x41, 0x4C, 0x20, 0x55, 0x53, 0x45, 0x20, 0x4F, 0x4E, 0x4C,
0x59, 0x2E, 0x20, 0x44, 0x4F, 0x20, 0x4E, 0x4F, 0x54, 0x20, 0x55, 0x53, 0x45, 0x20, 0x4F, 0x4E, 0x20, 0x41, 0x20, 0x50,
0x52, 0x4F, 0x44, 0x55, 0x43, 0x54, 0x49, 0x4F, 0x4E, 0x20, 0x52, 0x45, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x4F, 0x52, 0x59,
0x2E,
0x20, 0x69, 0x73, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2E,
// restore command
// -------------------------------------------------------------------------------------------------------------------------
@ -1209,10 +1197,19 @@ static const unsigned char helpDataPack[] =
// cipher-pass option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x0A, // Internal
pckTypeStr << 4 | 0x08, 0x07, // Section
0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
pckTypeStr << 4 | 0x08, 0x26, // Summary
0x43, 0x69, 0x70, 0x68, 0x65, 0x72, 0x20, 0x70, 0x61, 0x73, 0x73, 0x70, 0x68, 0x72, 0x61, 0x73, 0x65, 0x20, 0x66, 0x6F,
0x72, 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x2E,
pckTypeStr << 4 | 0x08, 0x3C, // Description
0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x79, 0x20, 0x61, 0x6E, 0x20, 0x61, 0x64, 0x20, 0x68, 0x6F, 0x63, 0x20, 0x63, 0x69,
0x70, 0x68, 0x65, 0x72, 0x20, 0x70, 0x61, 0x73, 0x73, 0x70, 0x68, 0x72, 0x61, 0x73, 0x65, 0x20, 0x66, 0x6F, 0x72, 0x20,
0x74, 0x68, 0x65, 0x20, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6E, 0x74, 0x20, 0x63, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x2E,
// cmd-ssh option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeStr << 4 | 0x0E, 0x01, 0x07, // Section
pckTypeStr << 4 | 0x0B, 0x07, // Section
0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
pckTypeStr << 4 | 0x08, 0x1E, // Summary
0x50, 0x61, 0x74, 0x68, 0x20, 0x74, 0x6F, 0x20, 0x73, 0x73, 0x68, 0x20, 0x63, 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x20, 0x65,
@ -1615,10 +1612,31 @@ static const unsigned char helpDataPack[] =
// exec-id option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x0A, // Internal
pckTypeStr << 4 | 0x08, 0x07, // Section
0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
pckTypeStr << 4 | 0x08, 0x22, // Summary
0x55, 0x6E, 0x69, 0x71, 0x75, 0x65, 0x20, 0x69, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x66, 0x6F,
0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2E,
pckTypeStr << 4 | 0x08, 0x9E, 0x02, // Description
0x41, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x6C, 0x79, 0x20, 0x75, 0x6E, 0x69, 0x71, 0x75, 0x65, 0x20, 0x69, 0x64, 0x65,
0x6E, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x20, 0x75, 0x73, 0x65, 0x64, 0x20, 0x74, 0x6F, 0x20, 0x69, 0x64, 0x65, 0x6E,
0x74, 0x69, 0x66, 0x79, 0x20, 0x61, 0x20, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x20, 0x77, 0x68, 0x65, 0x6E, 0x20,
0x72, 0x65, 0x73, 0x6F, 0x6C, 0x76, 0x69, 0x6E, 0x67, 0x20, 0x6C, 0x6F, 0x63, 0x6B, 0x73, 0x20, 0x6F, 0x6E, 0x20, 0x61,
0x20, 0x72, 0x65, 0x6D, 0x6F, 0x74, 0x65, 0x20, 0x68, 0x6F, 0x73, 0x74, 0x2E, 0x0A, 0x0A,
0x54, 0x68, 0x65, 0x20, 0x65, 0x78, 0x65, 0x63, 0x2D, 0x69, 0x64, 0x20, 0x6F, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x69,
0x73, 0x20, 0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x20, 0x61, 0x75, 0x74, 0x6F, 0x6D, 0x61, 0x74, 0x69,
0x63, 0x61, 0x6C, 0x6C, 0x79, 0x20, 0x77, 0x68, 0x65, 0x6E, 0x20, 0x6E, 0x65, 0x65, 0x64, 0x65, 0x64, 0x20, 0x62, 0x75,
0x74, 0x20, 0x69, 0x74, 0x20, 0x69, 0x73, 0x20, 0x70, 0x6F, 0x73, 0x73, 0x69, 0x62, 0x6C, 0x65, 0x20, 0x74, 0x6F, 0x20,
0x73, 0x65, 0x74, 0x20, 0x69, 0x74, 0x20, 0x65, 0x78, 0x70, 0x6C, 0x69, 0x63, 0x69, 0x74, 0x6C, 0x79, 0x2C, 0x20, 0x77,
0x68, 0x69, 0x63, 0x68, 0x20, 0x73, 0x61, 0x76, 0x65, 0x73, 0x20, 0x61, 0x20, 0x62, 0x69, 0x74, 0x20, 0x6F, 0x66, 0x20,
0x74, 0x69, 0x6D, 0x65, 0x20, 0x61, 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x75, 0x70, 0x20, 0x62, 0x75, 0x74, 0x20,
0x69, 0x6E, 0x74, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x70, 0x72, 0x6F, 0x62, 0x6C,
0x65, 0x6D, 0x20, 0x6F, 0x66, 0x20, 0x73, 0x65, 0x6C, 0x65, 0x63, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x61, 0x20, 0x75, 0x6E,
0x69, 0x71, 0x75, 0x65, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x2E,
// expire-auto option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeStr << 4 | 0x0E, 0x01, 0x06, // Section
pckTypeStr << 4 | 0x0B, 0x06, // Section
0x62, 0x61, 0x63, 0x6B, 0x75, 0x70,
pckTypeStr << 4 | 0x08, 0x3F, // Summary
0x41, 0x75, 0x74, 0x6F, 0x6D, 0x61, 0x74, 0x69, 0x63, 0x61, 0x6C, 0x6C, 0x79, 0x20, 0x72, 0x75, 0x6E, 0x20, 0x74, 0x68,
@ -1727,6 +1745,12 @@ static const unsigned char helpDataPack[] =
pckTypeObj << 4, // Command stanza-create override begin
pckTypeBool << 4 | 0x08, // Internal
pckTypeStr << 4 | 0x08, 0x16, // Summary
0x46, 0x6F, 0x72, 0x63, 0x65, 0x20, 0x73, 0x74, 0x61, 0x6E, 0x7A, 0x61, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74,
0x69, 0x6F, 0x6E, 0x2E,
pckTypeStr << 4 | 0x08, 0x23, // Description
0x54, 0x68, 0x69, 0x73, 0x20, 0x6F, 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x69, 0x73, 0x20, 0x6E, 0x6F, 0x20,
0x6C, 0x6F, 0x6E, 0x67, 0x65, 0x72, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6F, 0x72, 0x74, 0x65, 0x64, 0x2E,
0x00, // Command stanza-create override end
pckTypeObj << 4, // Command stanza-delete override begin
@ -1817,14 +1841,38 @@ static const unsigned char helpDataPack[] =
// job-retry option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x0A, // Internal
pckTypeStr << 4 | 0x08, 0x07, // Section
0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
pckTypeStr << 4 | 0x08, 0x1B, // Summary
0x52, 0x65, 0x74, 0x72, 0x79, 0x20, 0x63, 0x6F, 0x75, 0x6E, 0x74, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x6C, 0x6F, 0x63, 0x61,
0x6C, 0x20, 0x6A, 0x6F, 0x62, 0x73, 0x2E,
pckTypeStr << 4 | 0x08, 0x4A, // Description
0x54, 0x68, 0x65, 0x20, 0x6E, 0x75, 0x6D, 0x62, 0x65, 0x72, 0x20, 0x6F, 0x66, 0x20, 0x72, 0x65, 0x74, 0x72, 0x69, 0x65,
0x73, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x6A, 0x6F, 0x62, 0x73, 0x20, 0x72, 0x75, 0x6E, 0x20, 0x69, 0x6E, 0x20, 0x74, 0x68,
0x65, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x20, 0x70, 0x72, 0x6F, 0x63, 0x65, 0x73, 0x73, 0x2C, 0x20, 0x65, 0x2E, 0x67,
0x2E, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x75, 0x70, 0x2E,
// job-retry-interval option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x0D, 0x01, // Internal
pckTypeBool << 4 | 0x0A, // Internal
pckTypeStr << 4 | 0x08, 0x07, // Section
0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
pckTypeStr << 4 | 0x08, 0x21, // Summary
0x52, 0x65, 0x74, 0x72, 0x79, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6C, 0x20, 0x61, 0x66, 0x74, 0x65, 0x72,
0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x72, 0x79, 0x2E,
pckTypeStr << 4 | 0x08, 0x91, 0x01, // Description
0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x72, 0x65, 0x74, 0x72, 0x79, 0x20, 0x69, 0x73, 0x20, 0x61,
0x6C, 0x77, 0x61, 0x79, 0x73, 0x20, 0x70, 0x65, 0x72, 0x66, 0x6F, 0x72, 0x6D, 0x65, 0x64, 0x20, 0x69, 0x6D, 0x6D, 0x65,
0x64, 0x69, 0x61, 0x74, 0x65, 0x6C, 0x79, 0x2E, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x6F, 0x70, 0x74, 0x69, 0x6F, 0x6E,
0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x69, 0x6E, 0x74, 0x65, 0x72,
0x76, 0x61, 0x6C, 0x20, 0x74, 0x6F, 0x20, 0x77, 0x61, 0x69, 0x74, 0x20, 0x28, 0x69, 0x6E, 0x20, 0x73, 0x65, 0x63, 0x6F,
0x6E, 0x64, 0x73, 0x29, 0x20, 0x62, 0x65, 0x66, 0x6F, 0x72, 0x65, 0x20, 0x70, 0x65, 0x72, 0x66, 0x6F, 0x72, 0x6D, 0x69,
0x6E, 0x67, 0x20, 0x65, 0x61, 0x63, 0x68, 0x20, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6F, 0x6E, 0x61, 0x6C, 0x20, 0x72,
0x65, 0x74, 0x72, 0x79, 0x2E,
// link-all option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeStr << 4 | 0x0E, 0x01, 0x07, // Section
pckTypeStr << 4 | 0x0B, 0x07, // Section
0x72, 0x65, 0x73, 0x74, 0x6F, 0x72, 0x65,
pckTypeStr << 4 | 0x08, 0x15, // Summary
0x52, 0x65, 0x73, 0x74, 0x6F, 0x72, 0x65, 0x20, 0x61, 0x6C, 0x6C, 0x20, 0x73, 0x79, 0x6D, 0x6C, 0x69, 0x6E, 0x6B, 0x73,
@ -2410,10 +2458,23 @@ static const unsigned char helpDataPack[] =
// pg-local option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x09, // Internal
pckTypeStr << 4 | 0x08, 0x06, // Section
0x73, 0x74, 0x61, 0x6E, 0x7A, 0x61,
pckTypeStr << 4 | 0x08, 0x14, // Summary
0x50, 0x6F, 0x73, 0x74, 0x67, 0x72, 0x65, 0x53, 0x51, 0x4C, 0x20, 0x69, 0x73, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x2E,
pckTypeStr << 4 | 0x08, 0x8D, 0x01, // Description
0x49, 0x6E, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x50, 0x6F, 0x73, 0x74, 0x67,
0x72, 0x65, 0x53, 0x51, 0x4C, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66,
0x69, 0x65, 0x64, 0x20, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x20, 0x69, 0x73, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x20, 0x61,
0x6E, 0x64, 0x20, 0x61, 0x6E, 0x79, 0x20, 0x50, 0x6F, 0x73, 0x74, 0x67, 0x72, 0x65, 0x53, 0x51, 0x4C, 0x20, 0x68, 0x6F,
0x73, 0x74, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x74, 0x68, 0x61, 0x74,
0x20, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x20, 0x28, 0x65, 0x2E, 0x67, 0x2E, 0x20, 0x70, 0x67, 0x31, 0x2D, 0x68, 0x6F, 0x73,
0x74, 0x29, 0x20, 0x73, 0x68, 0x6F, 0x75, 0x6C, 0x64, 0x20, 0x62, 0x65, 0x20, 0x69, 0x67, 0x6E, 0x6F, 0x72, 0x65, 0x64,
0x2E,
// pg-path option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeStr << 4 | 0x0E, 0x01, 0x06, // Section
pckTypeStr << 4 | 0x0B, 0x06, // Section
0x73, 0x74, 0x61, 0x6E, 0x7A, 0x61,
pckTypeStr << 4 | 0x08, 0x1A, // Summary
0x50, 0x6F, 0x73, 0x74, 0x67, 0x72, 0x65, 0x53, 0x51, 0x4C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x64, 0x69, 0x72, 0x65,
@ -3084,10 +3145,23 @@ static const unsigned char helpDataPack[] =
// repo-local option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x09, // Internal
pckTypeStr << 4 | 0x08, 0x0A, // Section
0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79,
pckTypeStr << 4 | 0x08, 0x14, // Summary
0x52, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x20, 0x69, 0x73, 0x20, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x2E,
pckTypeStr << 4 | 0x08, 0x93, 0x01, // Description
0x49, 0x6E, 0x64, 0x69, 0x63, 0x61, 0x74, 0x65, 0x73, 0x20, 0x74, 0x68, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x72,
0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x70,
0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x20, 0x69, 0x73, 0x20, 0x6C, 0x6F, 0x63,
0x61, 0x6C, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x61, 0x6E, 0x79, 0x20, 0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72,
0x79, 0x20, 0x68, 0x6F, 0x73, 0x74, 0x20, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6E, 0x67, 0x73, 0x20, 0x66, 0x6F, 0x72, 0x20,
0x74, 0x68, 0x61, 0x74, 0x20, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x20, 0x28, 0x65, 0x2E, 0x67, 0x2E, 0x20, 0x72, 0x65, 0x70,
0x6F, 0x31, 0x2D, 0x68, 0x6F, 0x73, 0x74, 0x29, 0x20, 0x73, 0x68, 0x6F, 0x75, 0x6C, 0x64, 0x20, 0x62, 0x65, 0x20, 0x69,
0x67, 0x6E, 0x6F, 0x72, 0x65, 0x64, 0x2E,
// repo-path option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeStr << 4 | 0x0E, 0x01, 0x0A, // Section
pckTypeStr << 4 | 0x0B, 0x0A, // Section
0x72, 0x65, 0x70, 0x6F, 0x73, 0x69, 0x74, 0x6F, 0x72, 0x79,
pckTypeStr << 4 | 0x08, 0x2A, // Summary
0x50, 0x61, 0x74, 0x68, 0x20, 0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x62, 0x61, 0x63, 0x6B, 0x75, 0x70, 0x73, 0x20, 0x61,
@ -3653,10 +3727,18 @@ static const unsigned char helpDataPack[] =
// sck-block option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeBool << 4 | 0x0A, // Internal
pckTypeStr << 4 | 0x08, 0x07, // Section
0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
pckTypeStr << 4 | 0x08, 0x17, // Summary
0x53, 0x6F, 0x63, 0x6B, 0x65, 0x74, 0x20, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x69, 0x6E, 0x67, 0x20, 0x65, 0x6E, 0x61, 0x62,
0x6C, 0x65, 0x2E,
pckTypeStr << 4 | 0x08, 0x26, // Description
0x45, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x20, 0x62, 0x6C, 0x6F, 0x63, 0x6B, 0x69, 0x6E, 0x67, 0x20, 0x6F, 0x6E, 0x20, 0x73,
0x6F, 0x63, 0x6B, 0x65, 0x74, 0x20, 0x63, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x2E,
// sck-keep-alive option
// -------------------------------------------------------------------------------------------------------------------------
pckTypeStr << 4 | 0x0E, 0x01, 0x07, // Section
pckTypeStr << 4 | 0x0B, 0x07, // Section
0x67, 0x65, 0x6E, 0x65, 0x72, 0x61, 0x6C,
pckTypeStr << 4 | 0x08, 0x12, // Summary
0x4B, 0x65, 0x65, 0x70, 0x2D, 0x61, 0x6C, 0x69, 0x76, 0x65, 0x20, 0x65, 0x6E, 0x61, 0x62, 0x6C, 0x65, 0x2E,
@ -3757,6 +3839,15 @@ static const unsigned char helpDataPack[] =
pckTypeObj << 4 | 0x05, // Command verify override begin
pckTypeBool << 4 | 0x08, // Internal
pckTypeStr << 4 | 0x08, 0x15, // Summary
0x42, 0x61, 0x63, 0x6B, 0x75, 0x70, 0x20, 0x73, 0x65, 0x74, 0x20, 0x74, 0x6F, 0x20, 0x76, 0x65, 0x72, 0x69,
0x66, 0x79, 0x2E,
pckTypeStr << 4 | 0x08, 0x4F, // Description
0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x20, 0x61, 0x6C, 0x6C, 0x20, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73,
0x65, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x20, 0x66, 0x69, 0x6C, 0x65,
0x73, 0x20, 0x61, 0x73, 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20,
0x74, 0x68, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x62, 0x61, 0x63, 0x6B,
0x75, 0x70, 0x20, 0x73, 0x65, 0x74, 0x2E,
0x00, // Command verify override end
0x00, // Command overrides end

View File

@ -99,10 +99,11 @@ helpRenderSplitSize(const String *string, const char *delimiter, size_t size)
Helper function for helpRender() to make output look good on a console
***********************************************************************************************************************************/
static String *
helpRenderText(const String *text, size_t indent, bool indentFirst, size_t length)
helpRenderText(const String *text, const bool internal, size_t indent, bool indentFirst, size_t length)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM(STRING, text);
FUNCTION_LOG_PARAM(BOOL, internal);
FUNCTION_LOG_PARAM(SIZE, indent);
FUNCTION_LOG_PARAM(BOOL, indentFirst);
FUNCTION_LOG_PARAM(SIZE, length);
@ -114,7 +115,8 @@ helpRenderText(const String *text, size_t indent, bool indentFirst, size_t lengt
String *result = strNew("");
// Split the text into paragraphs
StringList *lineList = strLstNewSplitZ(text, "\n");
StringList *lineList = strLstNewSplitZ(
strNewFmt("%s%s", strZ(text), internal ? "\n\nFOR INTERNAL USE ONLY. DO NOT USE IN PRODUCTION." : ""), "\n");
// Iterate through each paragraph and split the lines according to the line length
for (unsigned int lineIdx = 0; lineIdx < strLstSize(lineList); lineIdx++)
@ -296,7 +298,7 @@ helpRender(void)
strCatFmt(
result, " %s%*s%s\n", cfgCommandName(commandId),
(int)(commandSizeMax - strlen(cfgCommandName(commandId)) + 2), "",
strZ(helpRenderText(commandData[commandId].summary, commandSizeMax + 6, false, CONSOLE_WIDTH)));
strZ(helpRenderText(commandData[commandId].summary, false, commandSizeMax + 6, false, CONSOLE_WIDTH)));
}
// Construct message for more help
@ -376,7 +378,9 @@ helpRender(void)
// If no additional params then this is command help
if (strLstEmpty(cfgCommandParam()))
{
// Output command summary and description
// Output command summary and description. Add a warning for internal commands.
CHECK(commandData[commandId].summary != NULL && commandData[commandId].description != NULL);
strCatFmt(
result,
" help\n"
@ -384,8 +388,10 @@ helpRender(void)
"%s\n"
"\n"
"%s\n",
strZ(helpRenderText(commandData[commandId].summary, 0, true, CONSOLE_WIDTH)),
strZ(helpRenderText(commandData[commandId].description, 0, true, CONSOLE_WIDTH)));
strZ(helpRenderText(commandData[commandId].summary, false, 0, true, CONSOLE_WIDTH)),
strZ(
helpRenderText(
commandData[commandId].description, commandData[commandId].internal, 0, true, CONSOLE_WIDTH)));
// Construct key/value of sections and options
KeyValue *optionKv = kvNew();
@ -463,7 +469,7 @@ helpRender(void)
strCatFmt(
result, " --%s%*s%s\n",
cfgParseOptionName(optionId), (int)(optionSizeMax - strlen(cfgParseOptionName(optionId)) + 2), "",
strZ(helpRenderText(summary, optionSizeMax + 6, false, CONSOLE_WIDTH)));
strZ(helpRenderText(summary, false, optionSizeMax + 6, false, CONSOLE_WIDTH)));
}
}
@ -499,7 +505,9 @@ helpRender(void)
if (!option.found || !cfgParseOptionValid(cfgCommand(), cfgCmdRoleDefault, option.id))
THROW_FMT(OptionInvalidError, "option '%s' is not valid for command '%s'", strZ(optionName), commandName);
// Output option summary and description
// Output option summary and description. Add a warning for internal options.
CHECK(optionData[option.id].summary != NULL && optionData[option.id].description != NULL);
strCatFmt(
result,
" - '%s' option help\n"
@ -508,8 +516,9 @@ helpRender(void)
"\n"
"%s\n",
cfgParseOptionName(option.id),
strZ(helpRenderText(optionData[option.id].summary, 0, true, CONSOLE_WIDTH)),
strZ(helpRenderText(optionData[option.id].description, 0, true, CONSOLE_WIDTH)));
strZ(helpRenderText(optionData[option.id].summary, false, 0, true, CONSOLE_WIDTH)),
strZ(
helpRenderText(optionData[option.id].description, optionData[option.id].internal, 0, true, CONSOLE_WIDTH)));
// Ouput current and default values if they exist
const String *defaultValue = helpRenderValue(cfgOptionDefault(option.id), cfgParseOptionType(option.id));

View File

@ -67,24 +67,30 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("helpRenderText()"))
{
TEST_RESULT_STR_Z(helpRenderText(strNew("this is a short sentence"), 0, false, 80), "this is a short sentence", "one line");
TEST_RESULT_STR_Z(
helpRenderText(strNew("this is a short sentence"), false, 0, false, 80), "this is a short sentence", "one line");
TEST_RESULT_STR_Z(
helpRenderText(strNew("this is a short sentence"), 4, false, 14),
helpRenderText(strNew("this is a short sentence"), false, 4, false, 14),
"this is a\n"
" short\n"
" sentence",
"three lines, no indent first");
TEST_RESULT_STR_Z(
helpRenderText(strNew("This is a short paragraph.\n\nHere is another one."), 2, true, 16),
helpRenderText(strNew("This is a short paragraph.\n\nHere is another one."), true, 2, true, 16),
" This is a\n"
" short\n"
" paragraph.\n"
"\n"
" Here is\n"
" another one.",
"two paragraphs, indent first");
" another one.\n"
"\n"
" FOR INTERNAL\n"
" USE ONLY. DO\n"
" NOT USE IN\n"
" PRODUCTION.",
"two paragraphs, indent first, internal");
}
// *****************************************************************************************************************************