diff --git a/libexec/rbenv-help b/libexec/rbenv-help index ef041525..84d6e464 100755 --- a/libexec/rbenv-help +++ b/libexec/rbenv-help @@ -144,7 +144,11 @@ print_usage() { local command="$1" local summary usage help eval "$(documentation_for "$command")" - [ -z "$usage" ] || echo "$usage" + if [ -n "$usage" ]; then + echo "$usage" + else + echo "Usage: rbenv ${command}" + fi } unset usage diff --git a/test/help.bats b/test/help.bats index 256549ee..3102136d 100644 --- a/test/help.bats +++ b/test/help.bats @@ -71,6 +71,18 @@ SH assert_success "Usage: rbenv hello " } +@test "empty usage section" { + mkdir -p "${RBENV_TEST_DIR}/bin" + cat > "${RBENV_TEST_DIR}/bin/rbenv-hello" < "${RBENV_TEST_DIR}/bin/rbenv-hello" <