parent
c371a3a26b
commit
3e62657575
12
nvm.sh
12
nvm.sh
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
# Auto detect the NVM_DIR
|
# Auto detect the NVM_DIR
|
||||||
if [ ! -d "$NVM_DIR" ]; then
|
if [ ! -d "$NVM_DIR" ]; then
|
||||||
export NVM_DIR=$(cd $(dirname ${BASH_SOURCE[0]:-$0}); pwd)
|
export NVM_DIR=$(cd $(dirname ${BASH_SOURCE[0]:-$0}) && pwd)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Expand a version using the version cache
|
# Expand a version using the version cache
|
||||||
|
@ -21,7 +21,7 @@ nvm_version()
|
||||||
|
|
||||||
VERSION=`nvm_ls $PATTERN | tail -n1`
|
VERSION=`nvm_ls $PATTERN | tail -n1`
|
||||||
echo "$VERSION"
|
echo "$VERSION"
|
||||||
|
|
||||||
if [ "$VERSION" = 'N/A' ]; then
|
if [ "$VERSION" = 'N/A' ]; then
|
||||||
return 13
|
return 13
|
||||||
fi
|
fi
|
||||||
|
@ -60,11 +60,11 @@ print_versions()
|
||||||
for VERSION in $1; do
|
for VERSION in $1; do
|
||||||
PADDED_VERSION=`printf '%10s' $VERSION`
|
PADDED_VERSION=`printf '%10s' $VERSION`
|
||||||
if [[ -d "$NVM_DIR/$VERSION" ]]; then
|
if [[ -d "$NVM_DIR/$VERSION" ]]; then
|
||||||
PADDED_VERSION="\033[0;34m$PADDED_VERSION\033[0m"
|
PADDED_VERSION="\033[0;34m$PADDED_VERSION\033[0m"
|
||||||
fi
|
fi
|
||||||
OUTPUT="$OUTPUT\n$PADDED_VERSION"
|
OUTPUT="$OUTPUT\n$PADDED_VERSION"
|
||||||
done
|
done
|
||||||
echo -e "$OUTPUT" | column
|
echo -e "$OUTPUT" | column
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm()
|
nvm()
|
||||||
|
@ -103,7 +103,7 @@ nvm()
|
||||||
if [ ! `which curl` ]; then
|
if [ ! `which curl` ]; then
|
||||||
echo 'NVM Needs curl to proceed.' >&2;
|
echo 'NVM Needs curl to proceed.' >&2;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
nvm help
|
nvm help
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue