help: print cli/parser help message if used

This commit is contained in:
Dawid Dziurla 2020-01-26 18:11:56 +01:00
parent d014d5a982
commit e9274b3827
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B
2 changed files with 4 additions and 1 deletions

View File

@ -94,7 +94,7 @@ begin
# - if cmd is Cask, let Cask handle the help command instead # - if cmd is Cask, let Cask handle the help command instead
if (empty_argv || help_flag) && cmd != "cask" if (empty_argv || help_flag) && cmd != "cask"
require "help" require "help"
Homebrew::Help.help cmd, empty_argv: empty_argv Homebrew::Help.help cmd, empty_argv: empty_argv, internal_cmd: internal_cmd
# `Homebrew.help` never returns, except for external/unknown commands. # `Homebrew.help` never returns, except for external/unknown commands.
end end

View File

@ -72,6 +72,9 @@ module Homebrew
# Resume execution in `brew.rb` for unknown commands. # Resume execution in `brew.rb` for unknown commands.
return if path.nil? return if path.nil?
# Resume execution in `brew.rb` for external commands using "cli/parser".
return if !flags[:internal_cmd] && path.read.match?("require .cli/parser.")
# Display help for internal command (or generic help if undocumented). # Display help for internal command (or generic help if undocumented).
puts command_help(path) puts command_help(path)
exit 0 exit 0