help: support #: help in external commands.
Fixes https://github.com/Homebrew/homebrew-test-bot/issues/3
This commit is contained in:
parent
cc59e624b0
commit
a4ebda3fc4
@ -75,12 +75,9 @@ begin
|
|||||||
end
|
end
|
||||||
|
|
||||||
# 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 a command is matched
|
||||||
# - a help flag is passed AND there is no command specified
|
# - 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
|
|
||||||
# arguments themselves.
|
|
||||||
if empty_argv || help_flag
|
if empty_argv || help_flag
|
||||||
require "cmd/help"
|
require "cmd/help"
|
||||||
Homebrew.help cmd, empty_argv: empty_argv
|
Homebrew.help cmd, empty_argv: empty_argv
|
||||||
|
|||||||
@ -39,6 +39,8 @@ module Homebrew
|
|||||||
if cmd
|
if cmd
|
||||||
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)
|
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)
|
||||||
path = Commands.path(cmd)
|
path = Commands.path(cmd)
|
||||||
|
path ||= which("brew-#{cmd}")
|
||||||
|
path ||= which("brew-#{cmd}.rb")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Display command-specific (or generic) help in response to `UsageError`.
|
# Display command-specific (or generic) help in response to `UsageError`.
|
||||||
@ -61,7 +63,7 @@ module Homebrew
|
|||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
# Resume execution in `brew.rb` for external/unknown commands.
|
# Resume execution in `brew.rb` for unknown commands.
|
||||||
return if path.nil?
|
return if path.nil?
|
||||||
|
|
||||||
# Display help for internal command (or generic help if undocumented).
|
# Display help for internal command (or generic help if undocumented).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user