From d92a1ad58434fdb6852405f28ae54494083471b0 Mon Sep 17 00:00:00 2001 From: Uladzislau Shablinski Date: Sat, 1 Oct 2016 18:17:52 +0300 Subject: [PATCH] brew.rb: update help parsing --- Library/Homebrew/brew.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 1ba3fb8c26..7efc4e7128 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -32,20 +32,17 @@ begin empty_argv = ARGV.empty? help_flag_list = %w[-h --help --usage -?] - help_flag = false + help_flag = !ENV["HOMEBREW_HELP"].nil? internal_cmd = true cmd = nil ARGV.dup.each_with_index do |arg, i| break if help_flag && cmd - if help_flag_list.include?(arg) - # Option-style help: Both `--help ` and ` --help` are fine. - help_flag = true - elsif arg == "help" && !cmd + if arg == "help" && !cmd # Command-style help: `help ` is fine, but ` help` is not. help_flag = true - elsif !cmd + elsif !cmd && !help_flag_list.include?(arg) cmd = ARGV.delete_at(i) end end