diff options
Diffstat (limited to 'Library/Homebrew/cmd/help.rb')
| -rw-r--r-- | Library/Homebrew/cmd/help.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index eae08395d..a6681c0b3 100644 --- a/Library/Homebrew/cmd/help.rb +++ b/Library/Homebrew/cmd/help.rb @@ -31,12 +31,14 @@ EOS # NOTE Keep lines less than 80 characters! Wrapping is just not cricket. # NOTE The reason the string is at the top is so 25 lines is easy to measure! +require "commands" + module Homebrew def help(cmd = nil, flags = {}) # Resolve command aliases and find file containing the implementation. if cmd cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd) - path = command_path(cmd) + path = Commands.path(cmd) end # Display command-specific (or generic) help in response to `UsageError`. @@ -69,18 +71,6 @@ module Homebrew private - def command_path(cmd) - if File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh") - HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh" - elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh") - HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh" - elsif File.exist?(HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb") - HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb" - elsif File.exist?(HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb") - HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb" - end - end - def command_help(path) help_lines = path.read.lines.grep(/^#:/) if help_lines.empty? |
