diff --git a/conf.d/rbenv.fish b/conf.d/rbenv.fish index cb21f65..f28c6ac 100644 --- a/conf.d/rbenv.fish +++ b/conf.d/rbenv.fish @@ -1,18 +1,20 @@ if not command -s rbenv > /dev/null - echo "rbenv: command not found. See https://github.com/rbenv/rbenv" + echo "Install to use 'rbenv'." exit 1 end -set -l rbenv_root '' +set -l rbenv_root "" + if test -z "$RBENV_ROOT" - set rbenv_root "$HOME/.rbenv" - set -x RBENV_ROOT "$HOME/.rbenv" + set rbenv_root ~/.rbenv + set -x RBENV_ROOT "$rbenv_root" else set rbenv_root "$RBENV_ROOT" end -set -x PATH $rbenv_root/shims $PATH -set -x RBENV_SHELL fish -if test ! -d "$rbenv_root/shims"; or test ! -d "$rbenv_root/versions" - command mkdir -p $rbenv_root/{shims,versions} +if status --is-login + set -x PATH "$rbenv_root/shims" $PATH + set -x RBENV_SHELL fish end +command mkdir -p "$rbenv_root/"{shims,versions} + diff --git a/functions/rbenv.fish b/functions/rbenv.fish index 922751d..8dbd7f1 100644 --- a/functions/rbenv.fish +++ b/functions/rbenv.fish @@ -24,8 +24,8 @@ function rbenv set -e argv[1] switch "$command" - case rehash shell - source (rbenv "sh-$command" $argv|psub) + case (command rbenv commands --sh) + source (command rbenv "sh-$command" $argv|psub) case '*' command rbenv "$command" $argv end