Skip to content

[New] nvm ls-remote: show latest aliases - #3920

Merged
ljharb merged 1 commit into
nvm-sh:masterfrom
ousamabenyounes:fix/2786-remote-alias-annotation
Sep 30, 2026
Merged

ljharb merged 1 commit into
nvm-sh:masterfrom
ousamabenyounes:fix/2786-remote-alias-annotation

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • annotate successful, unfiltered nvm ls-remote output with named local aliases and the latest node alias, including aliases that resolve to node on an LTS row
  • omit the obsolete built-in stable and unstable aliases and safely ignore malformed or non-printable alias names
  • preserve filtered, LTS-only, and failed output, including when similarly named environment state exists
  • add POSIX-shell regression coverage for colored and non-colored output

Test verification (RED → GREEN)

  • RED before the review fix: bare nvm ls-remote did not annotate a named alias; got >v1.0.0 (LTS: Argon)<
  • GREEN after the fix: the focused named-alias regression passes under sh, Bash, and Dash with GNU awk and mawk; the pinned-container zsh run also passes
  • RED for the CI-discovered unload regression: function pollution found: > nvm_get_remote_aliases<
  • GREEN after registering the helper for unload: the existing unload regression passes under sh, Bash, and Dash; reverting that line reproduces the RED result

Validation

  • focused named-alias and unload regressions: sh, Bash, and Dash
  • awk portability: GNU awk and mawk
  • shell portability: pinned-container zsh
  • ShellCheck: nvm.sh under Bash, sh, Dash, and ksh dialects
  • EditorConfig lint and git diff --check

Fixes #2786.

@ljharb ljharb 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.

Please add examples of using named aliases as well, including when node is also an LTS version, or a local alias is.

Also, let's not include stable or unstable, since these are outdated built-in alias names.

Comment thread test/fast/Unit tests/mocks/nvm ls-remote.txt Outdated
@ljharb
ljharb marked this pull request as draft September 10, 2026 20:43
@ousamabenyounes
ousamabenyounes force-pushed the fix/2786-remote-alias-annotation branch from 03e2b45 to a1effe9 Compare September 11, 2026 10:22
…cal aliases

Fixes nvm-sh#2786.

Ben Younes added the alias annotations to bare `nvm ls-remote`, with their regression tests;
Jordan Harband moved `(Latest: node)` onto the newest node release, gave each kind of annotation a fixed column so the output can be sliced with `cut`, matched aliases to versions in one pass, and kept local aliases out of the mocks and tests.

Co-authored-by: Ben Younes <2910651+ousamabenyounes@users.noreply.github.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
@ousamabenyounes
ousamabenyounes force-pushed the fix/2786-remote-alias-annotation branch from d5ea0c8 to a4b6562 Compare September 23, 2026 21:36
@ousamabenyounes

Copy link
Copy Markdown
Contributor Author

Addressed @ljharb's review: the latest line now shows (Latest: node, stable) — node is defined as the stable alias, so both built-ins are listed together while legacy unstable is omitted. Updated nvm.sh, the nvm ls-remote.txt mock, and the nvm ls-remote aliases unit test.

Verified locally RED→GREEN: the unit test fails on node alone and passes with the change (hermetic, no network); the mock matches the real output byte-for-byte apart from color codes. Also rebased onto master to drop the merge commit that was failing the Automatic Rebase check — it and all 36 fast/tests (slow) jobs are now green with 0 failures (the earlier install-latest-npm (18) self-signed-cert error was a transient flake, now passing).

Still open: PR remains a draft pending your go-ahead to mark it ready.

@ljharb
ljharb force-pushed the fix/2786-remote-alias-annotation branch 2 times, most recently from edd203d to a8bb497 Compare September 30, 2026 04:18
@ousamabenyounes
ousamabenyounes marked this pull request as ready for review September 30, 2026 04:49

@ljharb ljharb 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.

made some tweaks, and added nvm_has_italics to master so we can use that styling for the aliases

@ljharb
ljharb merged commit a8bb497 into nvm-sh:master Sep 30, 2026
315 of 316 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nvm ls-remote should show "node" / "stable" alias

2 participants