brew.rb: handle single usage flag case.

This commit is contained in:
Mike McQuaid 2014-06-26 09:27:22 +01:00
parent f61633a076
commit 7673c40f25

View File

@ -114,12 +114,13 @@ begin
# Usage instructions should be displayed if and only if one of: # Usage instructions should be displayed if and only if one of:
# - a help flag is passed AND an internal command is matched # - a help flag is passed AND an internal command is matched
# - a help flag is passed AND there is no command specified
# - no arguments are passed # - no arguments are passed
# #
# It should never affect external commands so they can handle usage # It should never affect external commands so they can handle usage
# arguments themselves. # arguments themselves.
if empty_argv || (internal_cmd && help_flag) if empty_argv || (help_flag && (cmd.nil? || internal_cmd))
# TODO - `brew help cmd` should display subcommand help # TODO - `brew help cmd` should display subcommand help
require 'cmd/help' require 'cmd/help'
puts ARGV.usage puts ARGV.usage