From af53c790cc468b50c4924e2bc11d18ca015fb04f Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Thu, 23 Mar 2017 14:47:12 +0100 Subject: [PATCH] Better error message for `rbenv shell` Shell integration is not enabled by default. This means that, from all the commands from `rbenv commands`, only "shell" won't work right away. Replace "no such command" with a more descriptive message that points to `rbenv init` instead. --- libexec/rbenv | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libexec/rbenv b/libexec/rbenv index e893220b..4880df38 100755 --- a/libexec/rbenv +++ b/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