aboutsummaryrefslogtreecommitdiffstats
path: root/Library/brew.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2014-05-26 10:36:27 -0700
committerAdam Vandenberg2014-05-27 21:03:05 -0700
commitdc04731ce11109836b337814ed336b80b64dd6e4 (patch)
tree5bd44e50f361d493f8b583b2b1851229f0653ccd /Library/brew.rb
parent355e06d433babe116156c126ae10ef44554e2b2b (diff)
downloadhomebrew-dc04731ce11109836b337814ed336b80b64dd6e4.tar.bz2
--help and --version only apply as first argument
This fixes external commands that provide their own help and version subcommands. Closes #26755.
Diffstat (limited to 'Library/brew.rb')
-rwxr-xr-xLibrary/brew.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/Library/brew.rb b/Library/brew.rb
index 6d7eb3d6f..60c3109f0 100755
--- a/Library/brew.rb
+++ b/Library/brew.rb
@@ -15,11 +15,12 @@ HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.dirname.parent.join("Lib
$:.unshift(HOMEBREW_LIBRARY_PATH.to_s)
require 'global'
-if ARGV.help?
+if ARGV.empty? || ARGV[0] =~ /(-h$|--help$|--usage$|-\?$|help$)/
+ # TODO - `brew help cmd` should display subcommand help
require 'cmd/help'
puts ARGV.usage
exit ARGV.any? ? 0 : 1
-elsif ARGV.version?
+elsif ARGV.first == '--version'
puts HOMEBREW_VERSION
exit 0
elsif ARGV.first == '-v'