Skip to content
Snippets Groups Projects
Commit d92a1ad5 authored by Uladzislau Shablinski's avatar Uladzislau Shablinski
Browse files

brew.rb: update help parsing

parent fd014978
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment