Skip to content
This repository was archived by the owner on Mar 16, 2022. It is now read-only.

Merge changes from ELLIOTTCABLE/master #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions nodenv.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FOUND_NODENV=0
found_nodenv=''
nodenvdirs=("$HOME/.nodenv" "$HOME/.local/nodenv" "/usr/local/opt/nodenv" "/usr/local/nodenv" "/opt/nodenv")

for nodenvdir in "${nodenvdirs[@]}" ; do
if [ -d $nodenvdir/bin -a $FOUND_NODENV -eq 0 ] ; then
FOUND_NODENV=1
if [[ $NODENV_ROOT = '' ]]; then
NODENV_ROOT=$nodenvdir
if [ -z "$found_nodenv" ] && [ -d "$nodenvdir/versions" ]; then
found_nodenv=true
if [ -z "$NODENV_ROOT" ]; then
NODENV_ROOT="$nodenvdir"
export NODENV_ROOT
fi
export NODENV_ROOT
export PATH=${nodenvdir}/bin:$PATH
export PATH="${nodenvdir}/bin:$PATH"
eval "$(nodenv init --no-rehash -)"

function current_node() {
Expand All @@ -22,6 +22,8 @@ for nodenvdir in "${nodenvdirs[@]}" ; do
done
unset nodenvdir

if [ $FOUND_NODENV -eq 0 ] ; then
function nodenv_prompt_info() { echo "system: $(node --version)" }
if [ -z "$found_nodenv" ]; then
function nodenv_prompt_info() {
echo "system: $(node --version)"
}
fi