brew.rb: fix overeager help flag matching

This commit is contained in:
Xu Cheng 2016-01-18 12:26:22 +08:00
parent b324d61f35
commit 27e8577f94

View File

@ -33,7 +33,7 @@ begin
trap("INT", std_trap) # restore default CTRL-C handler
empty_argv = ARGV.empty?
help_regex = /(-h$|--help$|--usage$|-\?$|^help$)/
help_flag_list = %w[-h --help --usage -? help]
help_flag = false
internal_cmd = true
cmd = nil
@ -41,7 +41,7 @@ begin
ARGV.dup.each_with_index do |arg, i|
if help_flag && cmd
break
elsif arg =~ help_regex
elsif help_flag_list.include? arg
help_flag = true
elsif !cmd
cmd = ARGV.delete_at(i)