redirect errors to stderr

master
Koen Punt 2014-06-17 00:40:07 +02:00
parent de03007348
commit 8dbbc32905
1 changed files with 41 additions and 41 deletions

30
nvm.sh
View File

@ -181,7 +181,7 @@ nvm_checksum() {
echo 'Checksums empty' #missing in raspberry pi binary
return
else
echo 'Checksums do not match.'
echo 'Checksums do not match.' >&2
return 1
fi
}
@ -308,7 +308,7 @@ nvm() {
fi
provided_version="$NVM_RC_VERSION"
fi
[ -d "$NVM_DIR/$provided_version" ] && echo "$provided_version is already installed." && return
[ -d "$NVM_DIR/$provided_version" ] && echo "$provided_version is already installed." >&2 && return
VERSION=`nvm_remote_version $provided_version`
ADDITIONAL_PARAMETERS=''
@ -322,13 +322,13 @@ nvm() {
done
if [ -d "$NVM_DIR/$VERSION" ]; then
echo "$VERSION is already installed."
echo "$VERSION is already installed." >&2
nvm use "$VERSION"
return $?
fi
if [ "$VERSION" = "N/A" ]; then
echo "Version '$provided_version' not found - try \`nvm ls-remote\` to browse available versions."
echo "Version '$provided_version' not found - try \`nvm ls-remote\` to browse available versions." >&2
return 3
fi
@ -395,10 +395,10 @@ nvm() {
if ! nvm_has "npm" ; then
echo "Installing npm..."
if [ "`expr "$VERSION" : '\(^v0\.1\.\)'`" != '' ]; then
echo "npm requires node v0.2.3 or higher"
echo "npm requires node v0.2.3 or higher" >&2
elif [ "`expr "$VERSION" : '\(^v0\.2\.\)'`" != '' ]; then
if [ "`expr "$VERSION" : '\(^v0\.2\.[0-2]$\)'`" != '' ]; then
echo "npm requires node v0.2.3 or higher"
echo "npm requires node v0.2.3 or higher" >&2
else
curl https://npmjs.org/install.sh | clean=yes npm_install=0.2.19 sh
fi
@ -407,7 +407,7 @@ nvm() {
fi
fi
else
echo "nvm: install $VERSION failed!"
echo "nvm: install $VERSION failed!" >&2
return 1
fi
;;
@ -415,12 +415,12 @@ nvm() {
[ $# -ne 2 ] && nvm help && return
PATTERN=`nvm_format_version $2`
if [ "$PATTERN" = `nvm_version` ]; then
echo "nvm: Cannot uninstall currently-active node version, $PATTERN."
echo "nvm: Cannot uninstall currently-active node version, $PATTERN." >&2
return 1
fi
VERSION=`nvm_version $PATTERN`
if [ ! -d $NVM_DIR/$VERSION ]; then
echo "$VERSION version is not installed..."
echo "$VERSION version is not installed..." >&2
return;
fi
@ -447,19 +447,19 @@ nvm() {
hash -r
echo "$NVM_DIR/*/bin removed from \$PATH"
else
echo "Could not find $NVM_DIR/*/bin in \$PATH"
echo "Could not find $NVM_DIR/*/bin in \$PATH" >&2
fi
if [ `expr "$MANPATH" : ".*$NVM_DIR/.*/share/man.*"` != 0 ] ; then
export MANPATH=`nvm_strip_path "$MANPATH" "/share/man"`
echo "$NVM_DIR/*/share/man removed from \$MANPATH"
else
echo "Could not find $NVM_DIR/*/share/man in \$MANPATH"
echo "Could not find $NVM_DIR/*/share/man in \$MANPATH" >&2
fi
if [ `expr "$NODE_PATH" : ".*$NVM_DIR/.*/lib/node_modules.*"` != 0 ] ; then
export NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
echo "$NVM_DIR/*/lib/node_modules removed from \$NODE_PATH"
else
echo "Could not find $NVM_DIR/*/lib/node_modules in \$NODE_PATH"
echo "Could not find $NVM_DIR/*/lib/node_modules in \$NODE_PATH" >&2
fi
;;
"use" )
@ -483,7 +483,7 @@ nvm() {
VERSION=`nvm_version $2`
fi
if [ ! -d "$NVM_DIR/$VERSION" ]; then
echo "$VERSION version is not installed yet"
echo "$VERSION version is not installed yet" >&2
return 1
fi
# Strip other version from PATH
@ -542,7 +542,7 @@ nvm() {
fi
if [ ! -d "$NVM_DIR/$VERSION" ]; then
echo "$VERSION version is not installed yet"
echo "$VERSION version is not installed yet" >&2
return;
fi
RUN_NODE_PATH=`nvm_strip_path "$NODE_PATH" "/lib/node_modules"`
@ -601,7 +601,7 @@ nvm() {
"unalias" )
mkdir -p $NVM_DIR/alias
[ $# -ne 2 ] && nvm help && return 127
[ ! -f "$NVM_DIR/alias/$2" ] && echo "Alias $2 doesn't exist!" && return
[ ! -f "$NVM_DIR/alias/$2" ] && echo "Alias $2 doesn't exist!" >&2 && return
rm -f $NVM_DIR/alias/$2
echo "Deleted alias $2"
;;