Skip to content
Myr

[Fix] `nvm unload`: drop the undefined `nvm_format_help_message_colors`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

`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.

authored by Jordan Harband · committed by Jordan Harband · parent 26fef4f · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:nvm.sh+1 added-1 removed
4954 unmodified lines
4955 nvm_sanitize_path nvm_has_colors nvm_process_parameters \4956 nvm_node_version_has_solaris_binary nvm_iojs_version_has_solaris_binary \4957 nvm_curl_libz_support nvm_command_info nvm_is_zsh nvm_stdout_is_terminal \4958 nvm_npmrc_bad_news_bears nvm_sanitize_auth_header \4959 nvm_get_colors nvm_set_colors nvm_print_color_code nvm_wrap_with_color_code nvm_format_help_message_colors \4959 nvm_get_colors nvm_set_colors nvm_print_color_code nvm_wrap_with_color_code \4960 nvm_print_color_legend \4961 nvm_echo_with_colors nvm_err_with_colors \4962 nvm_get_artifact_compression nvm_install_binary_extract nvm_extract_tarball \4963 nvm_process_nvmrc nvm_process_nvmrc_content nvm_nvmrc_invalid_msg \
175 unmodified lines