Move --help handling of dev commands to help.rb

This commit is contained in:
Gautham Goli 2018-08-03 01:48:01 +05:30
parent acd9a335a5
commit df101dde84
No known key found for this signature in database
GPG Key ID: 6A9ABBC284468364
2 changed files with 4 additions and 1 deletions

View File

@ -73,7 +73,7 @@ begin
# - a help flag is passed AND there is no command specified
# - no arguments are passed
# - if cmd is Cask, let Cask handle the help command instead
if (empty_argv || help_flag) && cmd != "cask" && !internal_dev_cmd
if (empty_argv || help_flag) && cmd != "cask"
require "help"
Homebrew::Help.help cmd, empty_argv: empty_argv
# `Homebrew.help` never returns, except for external/unknown commands.

View File

@ -38,6 +38,9 @@ module Homebrew
module_function
def help(cmd = nil, flags = {})
# Let OptionParser generate help text for developer commands
return if require? HOMEBREW_LIBRARY_PATH/"dev-cmd"/cmd
# Resolve command aliases and find file containing the implementation.
if cmd
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)