-
Notifications
You must be signed in to change notification settings - Fork 2.3k
node_version_prompt
should work without NVM
#1946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
b935ddd
1a96dd1
4125123
f7c3256
78d19e7
289a9d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check would give a false positive when using version management shims that are common with tools like asdf There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you clarify? What do you mean by a false positive? if |
||
echo -e "${NVM_THEME_PROMPT_PREFIX}${node_version}${NVM_THEME_PROMPT_SUFFIX}" | ||
fi | ||
fi | ||
} | ||
|
||
function node_version_prompt { | ||
local node_version="$(nvm_version_prompt)" | ||
kigster marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
|
Uh oh!
There was an error while loading. Please reload this page.