diff --git a/libexec/rbenv-init b/libexec/rbenv-init index 1a2762c7..22d509bc 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -101,7 +101,12 @@ if [[ ":${PATH}:" != *:"${RBENV_ROOT}/shims":* ]]; then fi completion="${root}/completions/rbenv.${shell}" -[ -r "$completion" ] && echo ". '$completion'" +if [ -r "$completion" ]; then + case "$shell" in + fish ) echo ". '$completion'" ;; + * ) echo "source '$completion'" ;; + esac +fi if [ -z "$no_rehash" ]; then echo 'rbenv rehash 2>/dev/null' diff --git a/test/init.bats b/test/init.bats index d0795eef..38771ef9 100644 --- a/test/init.bats +++ b/test/init.bats @@ -21,7 +21,7 @@ load test_helper root="$(cd $BATS_TEST_DIRNAME/.. && pwd)" SHELL=/bin/bash run rbenv-init - assert_success - assert_line ". '${root}/libexec/../completions/rbenv.bash'" + assert_line "source '${root}/libexec/../completions/rbenv.bash'" } @test "setup shell completions (fish)" {