From 72b62e13aa43fb8252fde133ad9a692f13917df9 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Wed, 28 Sep 2011 10:59:02 -0500 Subject: [PATCH] Make `rbenv help` a little nicer --- libexec/rbenv-help | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libexec/rbenv-help b/libexec/rbenv-help index ff0a1d7b..7204b2a1 100755 --- a/libexec/rbenv-help +++ b/libexec/rbenv-help @@ -31,8 +31,8 @@ Some useful rbenv commands are: which Show the full path for the given Ruby command whence List all Ruby versions with the given command -See 'rbenv help ' for more information on a specific command. -For more information, see: https://github.com/sstephenson/rbenv#readme" +See 'rbenv help ' for information on a specific command. +For full documentation, see: https://github.com/sstephenson/rbenv#readme" ;; global) echo "usage: rbenv global @@ -74,5 +74,15 @@ whence) echo "usage: rbenv whence Lists all Ruby versions with the given command installed." ;; -*) echo "No command arguments needed or invalid/undocumented command." +*) + command_path="$(command -v "rbenv-$1" || true)" + if [ -n "$command_path" ]; then + echo "Sorry, the \`$1' command isn't documented yet." + echo + echo "You can view the command's source here:" + echo "$command_path" + echo + else + echo "rbenv: no such command \`$1'" + fi esac