diff --git a/libexec/rbenv-completions b/libexec/rbenv-completions index 196212e..4cb020c 100755 --- a/libexec/rbenv-completions +++ b/libexec/rbenv-completions @@ -11,6 +11,10 @@ if [ -z "$COMMAND" ]; then fi COMMAND_PATH="$(command -v "rbenv-$COMMAND" || command -v "rbenv-sh-$COMMAND")" + +# --help is provided automatically +echo --help + if grep -iE "^([#%]|--|//) provide rbenv completions" "$COMMAND_PATH" >/dev/null; then shift exec "$COMMAND_PATH" --complete "$@" diff --git a/test/completions.bats b/test/completions.bats index 9091f08..6871cf5 100644 --- a/test/completions.bats +++ b/test/completions.bats @@ -13,7 +13,7 @@ create_command() { create_command "rbenv-hello" "#!$BASH echo hello" run rbenv-completions hello - assert_success "" + assert_success "--help" } @test "command with completion support" { @@ -25,7 +25,11 @@ else exit 1 fi" run rbenv-completions hello - assert_success "hello" + assert_success + assert_output <