1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Do not lower-case help summaries when first word is an acronym.

If the second letter is capital or a digit then the word is likely an acronym so don't lower-case the first letter.

For now only the digit case is checked since there are no summaries with a capital as the second letter.
This commit is contained in:
David Steele 2021-02-19 10:29:29 -05:00
parent 66a4ff496a
commit 5b98968605
2 changed files with 21 additions and 16 deletions

View File

@ -3,6 +3,7 @@ Help Command
***********************************************************************************************************************************/
#include "build.auto.h"
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
@ -359,9 +360,13 @@ helpRender(void)
{
ConfigOption optionId = varUInt(varLstGet(optionList, optionIdx));
// Get option summary
String *summary = strFirstLower(
strNewN(strZ(optionData[optionId].summary), strSize(optionData[optionId].summary) - 1));
// Get option summary and lower-case first letter if it does not appear to be part of an acronym
String *summary = strNewN(strZ(optionData[optionId].summary), strSize(optionData[optionId].summary) - 1);
ASSERT(strSize(summary) > 1);
ASSERT(!isupper(strZ(summary)[1]));
if (!isdigit(strZ(summary)[1]))
strFirstLower(summary);
// Ouput current and default values if they exist
const String *defaultValue = helpRenderValue(cfgOptionDefault(optionId), cfgParseOptionType(optionId));

View File

@ -220,19 +220,19 @@ testRun(void)
" [default=pgbackrest]\n"
" --repo-path path where backups and archive are stored\n"
" [default=/var/lib/pgbackrest]\n"
" --repo-s3-bucket s3 repository bucket\n"
" --repo-s3-ca-file s3 SSL CA File\n"
" --repo-s3-ca-path s3 SSL CA Path\n"
" --repo-s3-endpoint s3 repository endpoint\n"
" --repo-s3-host s3 repository host\n"
" --repo-s3-key s3 repository access key\n"
" --repo-s3-key-secret s3 repository secret access key\n"
" --repo-s3-key-type s3 repository key type [default=shared]\n"
" --repo-s3-port s3 repository port [default=443]\n"
" --repo-s3-region s3 repository region\n"
" --repo-s3-role s3 repository role\n"
" --repo-s3-token s3 repository security token\n"
" --repo-s3-uri-style s3 URI Style [default=host]\n"
" --repo-s3-bucket S3 repository bucket\n"
" --repo-s3-ca-file S3 SSL CA File\n"
" --repo-s3-ca-path S3 SSL CA Path\n"
" --repo-s3-endpoint S3 repository endpoint\n"
" --repo-s3-host S3 repository host\n"
" --repo-s3-key S3 repository access key\n"
" --repo-s3-key-secret S3 repository secret access key\n"
" --repo-s3-key-type S3 repository key type [default=shared]\n"
" --repo-s3-port S3 repository port [default=443]\n"
" --repo-s3-region S3 repository region\n"
" --repo-s3-role S3 repository role\n"
" --repo-s3-token S3 repository security token\n"
" --repo-s3-uri-style S3 URI Style [default=host]\n"
" --repo-s3-verify-tls verify S3 server certificate [default=y]\n"
" --repo-type type of storage used for the repository\n"
" [default=posix]\n"