Просмотр исходного кода

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

Better error message for `rbenv shell`
pull/1133/head
Mislav Marohnić 8 лет назад
committed by GitHub
Родитель
Сommit
b943955dbf
Не найден GPG ключ соответствующий данной подписи Идентификатор GPG ключа: 4AEE18F83AFDEB23
2 измененных файлов: 18 добавлений и 1 удалений
  1. +7
    -1
      libexec/rbenv
  2. +11
    -0
      test/shell.bats

+ 7
- 1
libexec/rbenv Просмотреть файл

@ -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

+ 11
- 0
test/shell.bats Просмотреть файл

@ -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"

Загрузка…
Отмена
Сохранить