From 569d464d361ba02ed77f20cff3399adf70953a58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Tue, 28 Jan 2020 17:47:59 +0100 Subject: [PATCH] Remove fish completion script fish ships with a much more capable rbenv completion script since fish 2.0. Fixes #1212 --- completions/rbenv.zsh | 18 ------------------ libexec/rbenv-init | 10 +++++----- test/init.bats | 5 +++-- 3 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 completions/rbenv.zsh diff --git a/completions/rbenv.zsh b/completions/rbenv.zsh deleted file mode 100644 index 5b23d42f..00000000 --- a/completions/rbenv.zsh +++ /dev/null @@ -1,18 +0,0 @@ -if [[ ! -o interactive ]]; then - return -fi - -compctl -K _rbenv rbenv - -_rbenv() { - local words completions - read -cA words - - if [ "${#words}" -eq 2 ]; then - completions="$(rbenv commands)" - else - completions="$(rbenv completions ${words[2,-2]})" - fi - - reply=("${(ps:\n:)completions}") -} diff --git a/libexec/rbenv-init b/libexec/rbenv-init index 855e9a58..7fb7ccd1 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -92,14 +92,14 @@ fish ) * ) echo 'export PATH="'${RBENV_ROOT}'/shims:${PATH}"' echo "export RBENV_SHELL=$shell" + + completion="${root}/completions/rbenv.${shell}" + if [ -r "$completion" ]; then + echo "source '$completion'" + fi ;; esac -completion="${root}/completions/rbenv.${shell}" -if [ -r "$completion" ]; then - echo "source '$completion'" -fi - if [ -z "$no_rehash" ]; then echo 'command rbenv rehash 2>/dev/null' fi diff --git a/test/init.bats b/test/init.bats index 6cf64e8b..6ea662b5 100755 --- a/test/init.bats +++ b/test/init.bats @@ -43,11 +43,12 @@ OUT assert_success "sh" } -@test "setup shell completions (fish)" { +@test "skip shell completions (fish)" { root="$(cd $BATS_TEST_DIRNAME/.. && pwd)" run rbenv-init - fish assert_success - assert_line "source '${root}/test/../libexec/../completions/rbenv.fish'" + local line="$(grep '^source' <<<"$output")" + [ -z "$line" ] || flunk "did not expect line: $line" } @test "fish instructions" {