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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
glasser authored and aduh95 committed Mar 28, 2021
1 parent ce6d756 commit 19ed27d
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 19ed27d

Please sign in to comment.