Permalink
Browse files

Merge pull request #981 from mhinz/shell-descriptive-error

Better error message for `rbenv shell`
  • Loading branch information...
mislav committed Dec 7, 2017
2 parents 6aa70b6 + 643023d commit b943955dbf10c436a8d4c7c36fd4216a34ef2b33
Showing with 18 additions and 1 deletion.
  1. +7 −1 libexec/rbenv
  2. +11 −0 test/shell.bats
View
@@ -106,7 +106,13 @@ case "$command" in
;;
* )
command_path="$(command -v "rbenv-$command" || true)"
[ -n "$command_path" ] || abort "no such command \`$command'"
if [ -z "$command_path" ]; then
if [ "$command" == "shell" ]; then
abort "shell integration not enabled. Run \`rbenv init' for instructions."
else
abort "no such command \`$command'"
fi
fi
shift 1
if [ "$1" = --help ]; then
View
@@ -2,6 +2,17 @@
load test_helper
@test "shell integration disabled" {
run rbenv shell
assert_failure "rbenv: shell integration not enabled. Run \`rbenv init' for instructions."
}
@test "shell integration enabled" {
eval "$(rbenv init -)"
run rbenv shell
assert_success "rbenv: no shell-specific version configured"
}
@test "no shell version" {
mkdir -p "${RBENV_TEST_DIR}/myproject"
cd "${RBENV_TEST_DIR}/myproject"

0 comments on commit b943955

Please sign in to comment.