From 5b98968605d5ce73918ee84d8bb3ec83b6f21c65 Mon Sep 17 00:00:00 2001 From: David Steele Date: Fri, 19 Feb 2021 10:29:29 -0500 Subject: [PATCH] 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. --- src/command/help/help.c | 11 ++++++++--- test/src/module/command/helpTest.c | 26 +++++++++++++------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/command/help/help.c b/src/command/help/help.c index e1b5df4a8..4407da51a 100644 --- a/src/command/help/help.c +++ b/src/command/help/help.c @@ -3,6 +3,7 @@ Help Command ***********************************************************************************************************************************/ #include "build.auto.h" +#include #include #include #include @@ -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)); diff --git a/test/src/module/command/helpTest.c b/test/src/module/command/helpTest.c index 9f209120a..0c9511c1b 100644 --- a/test/src/module/command/helpTest.c +++ b/test/src/module/command/helpTest.c @@ -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"