From eabe9dc6d058bb7f497810d10544845752e15ff8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 13 Feb 2014 20:26:29 +0000 Subject: 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 Homebrew/homebrew#26675. Signed-off-by: Mike McQuaid --- Library/Homebrew/extend/ARGV.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Library/Homebrew') 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 -- cgit v1.2.3