help: Let OptionParser generate help text for supported commands

This commit is contained in:
Gautham Goli
2018-10-03 19:49:45 +05:30
parent f60582ca48
commit 604dfb4ae6
2 changed files with 8 additions and 3 deletions
+1 -1
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
+7 -2
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