[Fix] nvm unload: drop the undefined nvm_format_help_message_colors

`unset -f` was passed a name that has never been a function.
It arrived with `set-colors` in 6848c16d and has never existed.

That matters because shells disagree about what `unset -f` does with a name that is not a function.
bash unsets the rest of the list and carries on;
Linux dash and zsh appear to stop there,
which silently left every one of the ten names after it defined:
`nvm_echo_with_colors`, `nvm_err_with_colors`,
`nvm_get_artifact_compression`, `nvm_install_binary_extract`,
`nvm_extract_tarball`, `nvm_process_nvmrc`,
`nvm_process_nvmrc_content`, `nvm_nvmrc_invalid_msg`,
`nvm_write_nvmrc`, and most recently `nvm_print_color_legend`.

Nothing noticed until `nvm_print_color_legend` gained a test
asserting that `nvm unload` removes it,
because it sorts first among the survivors.

With the dead name gone,
every remaining entry is a real function,
so no shell has an undefined name to disagree about.
This commit is contained in:
Jordan Harband
2026-09-03 13:57:58 -07:00
parent 26fef4fe1a
commit 812a76bb41
+1 -1
View File
@@ -4956,7 +4956,7 @@ nvm() {
nvm_node_version_has_solaris_binary nvm_iojs_version_has_solaris_binary \
nvm_curl_libz_support nvm_command_info nvm_is_zsh nvm_stdout_is_terminal \
nvm_npmrc_bad_news_bears nvm_sanitize_auth_header \
nvm_get_colors nvm_set_colors nvm_print_color_code nvm_wrap_with_color_code nvm_format_help_message_colors \
nvm_get_colors nvm_set_colors nvm_print_color_code nvm_wrap_with_color_code \
nvm_print_color_legend \
nvm_echo_with_colors nvm_err_with_colors \
nvm_get_artifact_compression nvm_install_binary_extract nvm_extract_tarball \