diff options
| author | Mike McQuaid | 2014-02-13 20:26:29 +0000 | 
|---|---|---|
| committer | Mike McQuaid | 2014-02-14 18:32:56 +0000 | 
| commit | bf41a56f1985ce6f38a9e5f8403f3512ce291d61 (patch) | |
| tree | 65f40a05f4ae8792e28d90463feb3ccb8020579b /Library/Homebrew | |
| parent | e974f97fef4b91e99b96123ca7ce989e43930422 (diff) | |
| download | homebrew-bf41a56f1985ce6f38a9e5f8403f3512ce291d61.tar.bz2 | |
brew: check for --help and friends in more of ARGV
Let's check for e.g. --help anywhere in the ARGV array rather than just
the first value to avoid brew upgrade --help causing problems.
Closes #26675.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/extend/ARGV.rb | 8 | 
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index c2e1a9c2e..55f6b356a 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -157,6 +157,14 @@ module HomebrewArgvExtension      include? '--force-bottle'    end +  def help? +    empty? || grep(/(-h|--help|--usage|-\?|help)/).any? +  end + +  def version? +    include? '--version' +  end +    # eg. `foo -ns -i --bar` has three switches, n, s and i    def switch? switch_character      return false if switch_character.length > 1  | 
