-
-
Save xenophonf/55ddae19078549eeede183e0d19a798d to your computer and use it in GitHub Desktop.
A wrapper for nvm that makes it work in other shells (specifically, csh and tcsh)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# load nvm | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] || exit 0 | |
\. "$NVM_DIR/nvm.sh" | |
# configure csh | |
if [ "$1" = "csh-env" ]; then | |
# use the 'default' version by default | |
if [ -z "$2" ]; then | |
set -- csh-env default | |
fi | |
nvm exec --silent "$2" printenv \ | |
| fgrep .nvm \ | |
| sed -e 's/^\(.*\)=\(.*\)/setenv \1 "\2";/' | |
exit 0 | |
fi | |
nvm "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment