aboutsummaryrefslogtreecommitdiffstats
path: root/Library/brew.rb
diff options
context:
space:
mode:
authorMartin Afanasjew2016-04-19 07:33:13 +0200
committerMartin Afanasjew2016-04-20 13:46:10 +0200
commitcf3486f98a5ddc8eae3c511f759471eff79cfcf8 (patch)
treef6436298ffd6347b2480e192c8d8d05e61f64f4e /Library/brew.rb
parent557ad956fdd9e3f403ea743d55a066341fab8132 (diff)
downloadbrew-cf3486f98a5ddc8eae3c511f759471eff79cfcf8.tar.bz2
help: show command-specific help for invalid usage
Instead of always printing the generic help text, print command-specific help if it is available and a command raised the `UsageError` exception. Put the error message underneath the help text (was above) to avoid that it scrolls off the screen. Thereby fix a regression where handling the invalid usage would fail to access `ARGV.usage` removed in c6536066dc39da653d265640c6ba6046bb5def98.
Diffstat (limited to 'Library/brew.rb')
-rw-r--r--Library/brew.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/brew.rb b/Library/brew.rb
index eb4fe0606..222b432ac 100644
--- a/Library/brew.rb
+++ b/Library/brew.rb
@@ -118,8 +118,8 @@ rescue FormulaUnspecifiedError
rescue KegUnspecifiedError
abort "This command requires a keg argument"
rescue UsageError
- onoe "Invalid usage"
- abort ARGV.usage
+ require "cmd/help"
+ Homebrew.help cmd, :usage_error => "Invalid usage"
rescue SystemExit => e
onoe "Kernel.exit" if ARGV.verbose? && !e.success?
$stderr.puts e.backtrace if ARGV.debug?