diff --git a/libexec/rbenv-completions b/libexec/rbenv-completions index 6de09ed2..196212e4 100755 --- a/libexec/rbenv-completions +++ b/libexec/rbenv-completions @@ -11,7 +11,7 @@ if [ -z "$COMMAND" ]; then fi COMMAND_PATH="$(command -v "rbenv-$COMMAND" || command -v "rbenv-sh-$COMMAND")" -if grep -i "^\([#%]\|--\|//\) provide rbenv completions" "$COMMAND_PATH" >/dev/null; then +if grep -iE "^([#%]|--|//) provide rbenv completions" "$COMMAND_PATH" >/dev/null; then shift exec "$COMMAND_PATH" --complete "$@" fi diff --git a/test/completions.bats b/test/completions.bats index 0feccfa9..9091f082 100644 --- a/test/completions.bats +++ b/test/completions.bats @@ -18,7 +18,7 @@ create_command() { @test "command with completion support" { create_command "rbenv-hello" "#!$BASH -# provide rbenv completions +# Provide rbenv completions if [[ \$1 = --complete ]]; then echo hello else