prezto/modules/node/functions/node-info

34 lines
858 B
Text
Raw Normal View History

2012-12-13 12:10:55 -03:00
#
# Exposes information about the Node.js environment via the $node_info
# associative array.
#
# Authors:
# Zeh Rizzatti <zehrizzatti@gmail.com>
# Robbie Trencheny <me@robbiet.us>
2012-12-13 12:10:55 -03:00
#
local version
local version_format
local version_formatted
unset node_info
typeset -gA node_info
if (( $+functions[nvm_version] )); then
version="${$(nvm_version)#iojs-#v}"
if nvm_is_iojs_version "$(nvm_version)"; then
fork="$(nvm_iojs_prefix)"
else
fork="$(nvm_node_prefix)"
fi
2012-12-13 12:10:55 -03:00
fi
if [[ "$version" != (none|) ]]; then
2012-12-13 12:10:55 -03:00
zstyle -s ':prezto:module:node:info:version' format 'version_format'
zformat -f version_formatted "$version_format" "v:$version"
zstyle -s ':prezto:module:node:info:fork' format 'fork_format'
zformat -f fork_formatted "$fork_format" "f:$fork"
2012-12-13 12:10:55 -03:00
node_info[version]="$version_formatted"
node_info[fork]="$fork_formatted"
2012-12-13 12:10:55 -03:00
fi