diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 4d6a1b7f..853b50c2 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -386,6 +386,27 @@ function hg_prompt_vars { fi } +function node_command_version_prompt { + local node_version + local node_command="$(command -v node)" + if [[ -n "${node_command}" ]]; then + node_version="$(${node_command} --version 2>/dev/null)" + if [[ -n ${node_version} ]]; then + echo -e "${NVM_THEME_PROMPT_PREFIX}${node_version}${NVM_THEME_PROMPT_SUFFIX}" + fi + fi +} + +function node_version_prompt { + local node_version="$(nvm_version_prompt)" + if [[ -z "${node_version}" ]]; then + node_version="$(node_command_version_prompt)" + fi + if [[ -n "${node_version}" ]] ; then + echo -e "${node_version}" + fi +} + function nvm_version_prompt { local node if declare -f -F nvm &> /dev/null; then @@ -395,10 +416,6 @@ function nvm_version_prompt { fi } -function node_version_prompt { - echo -e "$(nvm_version_prompt)" -} - function rvm_version_prompt { if which rvm &> /dev/null; then rvm=$(rvm-prompt) || return