diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 41955e60e0..3c561e8573 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -32,7 +32,7 @@ begin empty_argv = ARGV.empty? help_flag_list = %w[-h --help --usage -?] - help_flag = !ENV["HOMEBREW_HELP"].nil? + help_flag = false internal_cmd = true cmd = nil @@ -44,6 +44,9 @@ begin help_flag = true elsif !cmd && !help_flag_list.include?(arg) cmd = ARGV.delete_at(i) + elsif help_flag_list.include?(arg) & cmd + # cmd determined, and it needs help + help_flag = true end end diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index d260be4e37..bd50e41a62 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -231,7 +231,7 @@ module Hbc return if @command == "help" && @args.empty? unknown_command = @args.empty? ? @command : @args.first - raise ArgumentError, "Unknown command: #{unknown_command}" + raise ArgumentError, "Unknown command: #{@command} #{@args.join(" ")}" end def purpose