feat: add volta support to node-info function

This commit is contained in:
Adam 2024-12-15 11:28:41 -08:00
parent c257740c53
commit 5291eae55a

View File

@ -6,8 +6,6 @@
# Zeh Rizzatti <zehrizzatti@gmail.com> # Zeh Rizzatti <zehrizzatti@gmail.com>
# #
# function node-info {
local version local version
local version_format local version_format
local version_formatted local version_formatted
@ -17,6 +15,8 @@ typeset -gA node_info
if (( $+commands[nodenv] )); then if (( $+commands[nodenv] )); then
version="${${$(nodenv version)#v}[(w)0]}" version="${${$(nodenv version)#v}[(w)0]}"
elif (( $+commands[volta] )); then
version="${${$(volta list node | grep 'default')#⚡ }[(w)2]}"
elif (( $+functions[nvm_version] )); then elif (( $+functions[nvm_version] )); then
version="${$(nvm_version)#v}" version="${$(nvm_version)#v}"
elif (( $+commands[node] )) ; then elif (( $+commands[node] )) ; then
@ -27,6 +27,4 @@ if [[ "$version" != (none|system) ]]; then
zstyle -s ':prezto:module:node:info:version' format 'version_format' zstyle -s ':prezto:module:node:info:version' format 'version_format'
zformat -f version_formatted "$version_format" "v:$version" zformat -f version_formatted "$version_format" "v:$version"
node_info[version]="$version_formatted" node_info[version]="$version_formatted"
fi fi
# }