mirror of
https://github.com/tj/n.git
synced 2024-11-21 18:48:57 +01:00
Added check_current_version
This commit is contained in:
parent
cea6c1153f
commit
7dccb39ea3
22
bin/n
22
bin/n
@ -71,23 +71,27 @@ display_n_version() {
|
||||
echo $VERSION && exit 0
|
||||
}
|
||||
|
||||
#
|
||||
# Check for installed version, and populate $version
|
||||
#
|
||||
|
||||
check_current_version() {
|
||||
if test `which node`; then
|
||||
installed=`node --version`
|
||||
installed=${installed:1:${#installed}}
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Display current node --version
|
||||
# and others installed.
|
||||
#
|
||||
|
||||
display_versions() {
|
||||
# Active version
|
||||
local installed
|
||||
if test `which node`; then
|
||||
local installed=`node --version`
|
||||
installed=${installed:1:${#installed}}
|
||||
fi
|
||||
|
||||
# Installed versions
|
||||
check_current_version
|
||||
for file in $VERSIONS_DIR/*; do
|
||||
local version=${file##*/}
|
||||
if test $version = $installed; then
|
||||
if test "$version" = "$installed"; then
|
||||
echo " \033[32m*\033[0m $version"
|
||||
else
|
||||
echo " $version"
|
||||
|
Loading…
Reference in New Issue
Block a user