src: indent long help text properly

The previous code passed an ignored argument to StringPrototypeTrimLeft,
and tried to trim a string that didn't start with whitespace. The trim
makes more sense after the indentation has been added. Now wrapped lines
actually show up with the rest of the help text.

Doing this made an uncharacteristic trailing newline in the
`--icu-data-dir` help text more obvious, so I removed that.

PR-URL: https://github.com/nodejs/node/pull/37911
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
David Glasser 2021-03-25 07:46:28 -07:00 committed by Antoine du Hamel
parent ce6d756298
commit 19ed27d61f
2 changed files with 3 additions and 3 deletions

View File

@ -152,8 +152,8 @@ function format(
else
text += StringPrototypeRepeat(' ', firstColumn - displayName.length);
text += indent(StringPrototypeTrimLeft(fold(displayHelpText, secondColumn),
firstColumn)) + '\n';
text += StringPrototypeTrimLeft(
indent(fold(displayHelpText, secondColumn), firstColumn)) + '\n';
}
if (maxFirstColumnUsed < firstColumn - 4) {

View File

@ -729,7 +729,7 @@ PerProcessOptionsParser::PerProcessOptionsParser(
AddOption("--icu-data-dir",
"set ICU data load path to dir (overrides NODE_ICU_DATA)"
#ifndef NODE_HAVE_SMALL_ICU
" (note: linked-in ICU data is present)\n"
" (note: linked-in ICU data is present)"
#endif
,
&PerProcessOptions::icu_data_dir,