Merge pull request #981 from mhinz/shell-descriptive-error
Better error message for `rbenv shell`
This commit is contained in:
commit
b943955dbf
@ -106,7 +106,13 @@ case "$command" in
|
|||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
command_path="$(command -v "rbenv-$command" || true)"
|
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
|
shift 1
|
||||||
if [ "$1" = --help ]; then
|
if [ "$1" = --help ]; then
|
||||||
|
@ -2,6 +2,17 @@
|
|||||||
|
|
||||||
load test_helper
|
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" {
|
@test "no shell version" {
|
||||||
mkdir -p "${RBENV_TEST_DIR}/myproject"
|
mkdir -p "${RBENV_TEST_DIR}/myproject"
|
||||||
cd "${RBENV_TEST_DIR}/myproject"
|
cd "${RBENV_TEST_DIR}/myproject"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user