From 19ed27d61fd74d8d6568ae4a9944151a5e0c9e6e Mon Sep 17 00:00:00 2001 From: David Glasser Date: Thu, 25 Mar 2021 07:46:28 -0700 Subject: [PATCH] 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 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Darshan Sen Reviewed-By: James M Snell --- lib/internal/main/print_help.js | 4 ++-- src/node_options.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/main/print_help.js b/lib/internal/main/print_help.js index 87db8a7cff7..02970130798 100644 --- a/lib/internal/main/print_help.js +++ b/lib/internal/main/print_help.js @@ -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) { diff --git a/src/node_options.cc b/src/node_options.cc index a0bbb1681cc..d5c26006887 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -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,