Skip to content

cli: style node --help output with util.styleText#64484

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
edsadr:help-styling
Jul 19, 2026
Merged

cli: style node --help output with util.styleText#64484
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
edsadr:help-styling

Conversation

@edsadr

@edsadr edsadr commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Apply util.styleText to the node --help output for improved visual hierarchy and scannability. Styling is applied only when the output stream supports color (detected via util.styleText's built-in shouldColorize), so piped/redirected output and NO_COLOR remain plain text with no behavior change.

  • Bold: Usage lines, Options:, Environment variables: headers
  • Bold green: CLI option names (e.g. --inspect, -e, --eval)
  • Bold magenta: environment variable names (e.g. NODE_PATH)
  • Dim: "(currently set)" annotation
  • Blue underline: documentation URL

Column-width math uses unstyled string lengths to preserve alignment regardless of styling. The "(currently set)" annotation is styled via post-processing after layout to avoid breaking the fold() width calculation.

Apply util.styleText to the `node --help` output for improved visual
hierarchy and scannability. Styling is applied only when the output
stream supports color (detected via util.styleText's built-in
shouldColorize), so piped/redirected output and NO_COLOR remain plain
text with no behavior change.

- Bold: Usage lines, Options:, Environment variables: headers
- Bold green: CLI option names (e.g. --inspect, -e, --eval)
- Bold magenta: environment variable names (e.g. NODE_PATH)
- Dim: "(currently set)" annotation
- Blue underline: documentation URL

Column-width math uses unstyled string lengths to preserve alignment
regardless of styling. The "(currently set)" annotation is styled via
post-processing after layout to avoid breaking the fold() width
calculation.

Signed-off-by: Adrian Estrada <edsadr@gmail.com>
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jul 14, 2026

@juanarbol juanarbol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.23%. Comparing base (ace91de) to head (97df780).
⚠️ Report is 44 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #64484   +/-   ##
=======================================
  Coverage   90.23%   90.23%           
=======================================
  Files         741      741           
  Lines      241681   241707   +26     
  Branches    45547    45549    +2     
=======================================
+ Hits       218075   218109   +34     
- Misses      15141    15149    +8     
+ Partials     8465     8449   -16     
Files with missing lines Coverage Δ
lib/internal/main/print_help.js 100.00% <100.00%> (ø)

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@RafaelGSS RafaelGSS added request-ci Add this label to start a Jenkins CI on a PR. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Jul 14, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 14, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

The NO_COLOR and alignment-preservation tests inherited FORCE_COLOR
from process.env, which takes precedence over NO_COLOR and caused
the tests to fail on CI environments where FORCE_COLOR is set.
Delete FORCE_COLOR from the child env in those test cases.

Signed-off-by: Adrian Estrada <edsadr@gmail.com>
@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 18, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@RafaelGSS RafaelGSS added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 19, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 19, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/64484
✔  Done loading data for nodejs/node/pull/64484
----------------------------------- PR info ------------------------------------
Title      cli: style node --help output with util.styleText (#64484)
Author     Adrián Estrada <edsadr@gmail.com> (@edsadr)
Branch     edsadr:help-styling -> nodejs:main
Labels     author ready, needs-ci
Commits    2
 - cli: style node --help output with util.styleText
 - test: fix help style test when FORCE_COLOR is in parent env
Committers 1
 - Adrian Estrada <edsadr@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64484
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/64484
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Tue, 14 Jul 2026 01:58:45 GMT
   ✔  Approvals: 4
   ✔  - Juan José Arboleda (@juanarbol): https://github.com/nodejs/node/pull/64484#pullrequestreview-4690530646
   ✔  - Rafael Gonzaga (@RafaelGSS) (TSC): https://github.com/nodejs/node/pull/64484#pullrequestreview-4696080500
   ✔  - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/64484#pullrequestreview-4729143206
   ✔  - Gürgün Dayıoğlu (@gurgunday): https://github.com/nodejs/node/pull/64484#pullrequestreview-4729503083
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-07-18T19:34:27Z: https://ci.nodejs.org/job/node-test-pull-request/74885/
- Querying data for job/node-test-pull-request/74885/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 64484
From https://github.com/nodejs/node
 * branch                  refs/pull/64484/merge -> FETCH_HEAD
✔  Fetched commits as d90d9d55ad30..97df78062569
--------------------------------------------------------------------------------
[main 3a81c1a921] cli: style node --help output with util.styleText
 Author: Adrian Estrada <edsadr@gmail.com>
 Date: Mon Jul 13 20:56:56 2026 -0500
 2 files changed, 86 insertions(+), 9 deletions(-)
 create mode 100644 test/parallel/test-cli-node-print-help-style.js
[main 21566742fb] test: fix help style test when FORCE_COLOR is in parent env
 Author: Adrian Estrada <edsadr@gmail.com>
 Date: Tue Jul 14 15:03:03 2026 -0500
 1 file changed, 2 insertions(+)
   ✔  Patches applied
There are 2 commits in the PR. Attempting autorebase.
(node:364) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/4)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
cli: style node --help output with util.styleText

Apply util.styleText to the node --help output for improved visual
hierarchy and scannability. Styling is applied only when the output
stream supports color (detected via util.styleText's built-in
shouldColorize), so piped/redirected output and NO_COLOR remain plain
text with no behavior change.

  • Bold: Usage lines, Options:, Environment variables: headers
  • Bold green: CLI option names (e.g. --inspect, -e, --eval)
  • Bold magenta: environment variable names (e.g. NODE_PATH)
  • Dim: "(currently set)" annotation
  • Blue underline: documentation URL

Column-width math uses unstyled string lengths to preserve alignment
regardless of styling. The "(currently set)" annotation is styled via
post-processing after layout to avoid breaking the fold() width
calculation.

Signed-off-by: Adrian Estrada <edsadr@gmail.com>
PR-URL: #64484
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>

[detached HEAD 025a022c33] cli: style node --help output with util.styleText
Author: Adrian Estrada <edsadr@gmail.com>
Date: Mon Jul 13 20:56:56 2026 -0500
2 files changed, 86 insertions(+), 9 deletions(-)
create mode 100644 test/parallel/test-cli-node-print-help-style.js
Rebasing (3/4)
Rebasing (4/4)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
test: fix help style test when FORCE_COLOR is in parent env

The NO_COLOR and alignment-preservation tests inherited FORCE_COLOR
from process.env, which takes precedence over NO_COLOR and caused
the tests to fail on CI environments where FORCE_COLOR is set.
Delete FORCE_COLOR from the child env in those test cases.

Signed-off-by: Adrian Estrada <edsadr@gmail.com>
PR-URL: #64484
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>

[detached HEAD 80634ccd7d] test: fix help style test when FORCE_COLOR is in parent env
Author: Adrian Estrada <edsadr@gmail.com>
Date: Tue Jul 14 15:03:03 2026 -0500
1 file changed, 2 insertions(+)
Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/29695364074

@RafaelGSS RafaelGSS added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jul 19, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 19, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 0bcc6ef into nodejs:main Jul 19, 2026
82 of 83 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 0bcc6ef

aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Apply util.styleText to the `node --help` output for improved visual
hierarchy and scannability. Styling is applied only when the output
stream supports color (detected via util.styleText's built-in
shouldColorize), so piped/redirected output and NO_COLOR remain plain
text with no behavior change.

- Bold: Usage lines, Options:, Environment variables: headers
- Bold green: CLI option names (e.g. --inspect, -e, --eval)
- Bold magenta: environment variable names (e.g. NODE_PATH)
- Dim: "(currently set)" annotation
- Blue underline: documentation URL

Column-width math uses unstyled string lengths to preserve alignment
regardless of styling. The "(currently set)" annotation is styled via
post-processing after layout to avoid breaking the fold() width
calculation.

Signed-off-by: Adrian Estrada <edsadr@gmail.com>
PR-URL: #64484
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Apply util.styleText to the `node --help` output for improved visual
hierarchy and scannability. Styling is applied only when the output
stream supports color (detected via util.styleText's built-in
shouldColorize), so piped/redirected output and NO_COLOR remain plain
text with no behavior change.

- Bold: Usage lines, Options:, Environment variables: headers
- Bold green: CLI option names (e.g. --inspect, -e, --eval)
- Bold magenta: environment variable names (e.g. NODE_PATH)
- Dim: "(currently set)" annotation
- Blue underline: documentation URL

Column-width math uses unstyled string lengths to preserve alignment
regardless of styling. The "(currently set)" annotation is styled via
post-processing after layout to avoid breaking the fold() width
calculation.

Signed-off-by: Adrian Estrada <edsadr@gmail.com>
PR-URL: #64484
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
aduh95 pushed a commit that referenced this pull request Jul 21, 2026
Apply util.styleText to the `node --help` output for improved visual
hierarchy and scannability. Styling is applied only when the output
stream supports color (detected via util.styleText's built-in
shouldColorize), so piped/redirected output and NO_COLOR remain plain
text with no behavior change.

- Bold: Usage lines, Options:, Environment variables: headers
- Bold green: CLI option names (e.g. --inspect, -e, --eval)
- Bold magenta: environment variable names (e.g. NODE_PATH)
- Dim: "(currently set)" annotation
- Blue underline: documentation URL

Column-width math uses unstyled string lengths to preserve alignment
regardless of styling. The "(currently set)" annotation is styled via
post-processing after layout to avoid breaking the fold() width
calculation.

Signed-off-by: Adrian Estrada <edsadr@gmail.com>
PR-URL: #64484
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants