diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/brew.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Library/brew.rb b/Library/brew.rb index 7207e22b6..38e11473c 100644 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -30,7 +30,7 @@ begin trap("INT", std_trap) # restore default CTRL-C handler empty_argv = ARGV.empty? - help_flag_list = %w[-h --help --usage -? help] + help_flag_list = %w[-h --help --usage -?] help_flag = false internal_cmd = true cmd = nil @@ -38,7 +38,11 @@ begin ARGV.dup.each_with_index do |arg, i| if help_flag && cmd break - elsif help_flag_list.include? arg + elsif help_flag_list.include?(arg) + # Option-style help: Both `--help <cmd>` and `<cmd> --help` are fine. + help_flag = true + elsif arg == "help" && !cmd + # Command-style help: `help <cmd>` is fine, but `<cmd> help` is not. help_flag = true elsif !cmd cmd = ARGV.delete_at(i) |
