From 2b21e22e976ae905bb80585ccfe9a57e1dcc64de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohnic=CC=81?= Date: Sat, 29 Dec 2012 22:03:04 +0100 Subject: [PATCH] display help for commands that have Summary but not Usage A command doesn't have to specify Usage docs if it doesn't accept any arguments. The default usage for a command will be printed as: Usage: rbenv ${command} --- libexec/rbenv-help | 8 ++++++-- libexec/rbenv-rehash | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libexec/rbenv-help b/libexec/rbenv-help index d43782c4..3bba20ad 100755 --- a/libexec/rbenv-help +++ b/libexec/rbenv-help @@ -97,8 +97,12 @@ print_help() { eval "$(documentation_for "$command")" [ -n "$help" ] || help="$summary" - if [ -n "$usage" ]; then - echo "$usage" + if [ -n "$usage" -o -n "$summary" ]; then + if [ -n "$usage" ]; then + echo "$usage" + else + echo "Usage: rbenv ${command}" + fi if [ -n "$help" ]; then echo echo "$help" diff --git a/libexec/rbenv-rehash b/libexec/rbenv-rehash index 0f147385..a50819dd 100755 --- a/libexec/rbenv-rehash +++ b/libexec/rbenv-rehash @@ -1,6 +1,5 @@ #!/usr/bin/env bash # Summary: Rehash rbenv shims (run this after installing binaries) -# Usage: rbenv rehash set -e [ -n "$RBENV_DEBUG" ] && set -x