diff options
| author | Adam Vandenberg | 2014-05-26 10:36:27 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2014-05-27 21:03:05 -0700 |
| commit | 2c61e3c02acfc09ee01ac3affc0374bebd83ead3 (patch) | |
| tree | 3844050ec6c4ca8da558499f2437513d9d7e6172 /Library/brew.rb | |
| parent | f446e95852591c0b03150f7443db233488d8ca1d (diff) | |
| download | brew-2c61e3c02acfc09ee01ac3affc0374bebd83ead3.tar.bz2 | |
--help and --version only apply as first argument
This fixes external commands that provide their own
help and version subcommands.
Closes Homebrew/homebrew#26755.
Diffstat (limited to 'Library/brew.rb')
| -rwxr-xr-x | Library/brew.rb | 5 |
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' |
