help: Let OptionParser generate help text for supported commands

This commit is contained in:
Gautham Goli 2018-10-02 19:34:46 +05:30
parent f60582ca48
commit 604dfb4ae6
No known key found for this signature in database
GPG Key ID: 6A9ABBC284468364
2 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,7 @@
#: * `prof` [ruby options]:
#: Run Homebrew with the Ruby profiler.
#: For example:
# brew prof readall
#: brew prof readall
module Homebrew
module_function

View File

@ -38,8 +38,13 @@ 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
# Let OptionParser generate help text for commands which have a parser defined
begin
Homebrew.send("#{cmd.gsub('-','_')}_args".to_sym)
return
rescue NoMethodError
nil
end
# Resolve command aliases and find file containing the implementation.
if cmd