aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorUladzislau Shablinski2016-10-01 18:17:52 +0300
committerUladzislau Shablinski2016-10-01 22:09:11 +0300
commitd92a1ad58434fdb6852405f28ae54494083471b0 (patch)
treed32186c9cdfd806130c60b486977fa3f141b4d3a /Library
parentfd0149783a8291a602d0f3a827745fa06429c412 (diff)
downloadbrew-d92a1ad58434fdb6852405f28ae54494083471b0.tar.bz2
brew.rb: update help parsing
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brew.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb
index 1ba3fb8c2..7efc4e712 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 <cmd>` and `<cmd> --help` are fine.
- help_flag = true
- elsif arg == "help" && !cmd
+ if arg == "help" && !cmd
# Command-style help: `help <cmd>` is fine, but `<cmd> help` is not.
help_flag = true
- elsif !cmd
+ elsif !cmd && !help_flag_list.include?(arg)
cmd = ARGV.delete_at(i)
end
end