mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-02-22 11:08:40 +08:00
[split] Move rbenv plugin to oh-my-fish/plugin-rbenv
https://github.com/oh-my-fish/plugin-rbenv
This commit is contained in:
parent
e1905dff55
commit
cdf9b288f3
@ -1,11 +0,0 @@
|
||||
function rbenv
|
||||
set command $argv[1]
|
||||
set -e argv[1]
|
||||
|
||||
switch "$command"
|
||||
case rehash shell
|
||||
eval (rbenv "sh-$command" $argv)
|
||||
case '*'
|
||||
command rbenv "$command" $argv
|
||||
end
|
||||
end
|
@ -1,49 +0,0 @@
|
||||
# Try to find rbenv by:
|
||||
# * Looking for $RBENV_BIN_ROOT/rbenv. This environment variable is specific to this plugin
|
||||
# * Looking for rbenv on $PATH
|
||||
# * Looking for rbenv in the user's home directory
|
||||
# When necessary, prepend the bin/ directory containing rbenv to our $PATH.
|
||||
if [ -e "$RBENV_BIN_ROOT/rbenv" ]
|
||||
set rbenv_binary "$RBENV_BIN_ROOT/rbenv"
|
||||
_prepend_path "$RBENV_BIN_ROOT"
|
||||
else if [ (which command; and command command -v rbenv) ]
|
||||
set rbenv_binary (command command -v rbenv)
|
||||
else if [ -e "$HOME/.rbenv/bin/rbenv" ]
|
||||
set rbenv_binary "$HOME/.rbenv/bin/rbenv"
|
||||
_prepend_path "$HOME/.rbenv/bin"
|
||||
else
|
||||
echo "Could not find rbenv. Make sure it's on your system path, in your home directory or set the RBENV_BIN_ROOT environment variable pointing to the directory where you unpacked rbenv."
|
||||
exit 1
|
||||
end
|
||||
|
||||
set -l supports_fish
|
||||
set -l supports_fish_version '0.4.0'
|
||||
set -l user_version (eval $rbenv_binary --version | sed -E 's/^rbenv ([[:digit:]\.]{2,}).*$/\1/g')
|
||||
|
||||
if [ $user_version = $supports_fish_version ]
|
||||
set -l supports_fish_commits '56'
|
||||
set -l user_commits (eval $rbenv_binary --version | sed -E 's/^.+-([[:digit:]]{1,}).+$/\1/g')
|
||||
if [ $user_commits -ge $supports_fish_commits ]
|
||||
set supports_fish true
|
||||
end
|
||||
else
|
||||
set -l higher_version (echo -e "$supports_fish_version\n$user_version" | \
|
||||
sort --field-separator . \
|
||||
--key 1,1 --numeric-sort --reverse \
|
||||
--key 2,2 --numeric-sort --reverse \
|
||||
--key 3,3 --numeric-sort --reverse | \
|
||||
head -n 1)
|
||||
if [ $user_version = $higher_version ]
|
||||
set supports_fish true
|
||||
end
|
||||
end
|
||||
|
||||
if [ $supports_fish ]
|
||||
status --is-interactive; and source (eval $rbenv_binary init - | psub)
|
||||
else
|
||||
if [ "$RBENV_ROOT" ]
|
||||
_prepend_path "$RBENV_ROOT/shims"
|
||||
else
|
||||
_prepend_path "$HOME/.rbenv/shims"
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user