Skip to content

Commit

Permalink
src: indent long help text properly
Browse files Browse the repository at this point in the history
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: #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>
  • Loading branch information
glasser authored and ruyadorno committed Mar 30, 2021
1 parent 13ecff6 commit b6ad8e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/internal/main/print_help.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b6ad8e4

Please sign in to comment.