From 604dfb4ae64270cfdf86a2355c8b795d9accd803 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Tue, 2 Oct 2018 19:34:46 +0530 Subject: [PATCH] help: Let OptionParser generate help text for supported commands --- Library/Homebrew/dev-cmd/prof.rb | 2 +- Library/Homebrew/help.rb | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/dev-cmd/prof.rb b/Library/Homebrew/dev-cmd/prof.rb index 0a7409ec53..ebf9dc98e3 100644 --- a/Library/Homebrew/dev-cmd/prof.rb +++ b/Library/Homebrew/dev-cmd/prof.rb @@ -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 diff --git a/Library/Homebrew/help.rb b/Library/Homebrew/help.rb index b1bc461e4e..3d334901bd 100644 --- a/Library/Homebrew/help.rb +++ b/Library/Homebrew/help.rb @@ -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