aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/help.rb
diff options
context:
space:
mode:
authorMike McQuaid2016-09-07 20:09:29 +0100
committerMike McQuaid2016-09-08 20:46:55 +0100
commitae57057afae0a714143de090a62ea772b097569c (patch)
tree285699d5b7209fead9c6b33004e69a2bd304b270 /Library/Homebrew/cmd/help.rb
parent49dcbee99c46d92d65e9132a555ed3fc2865c1e6 (diff)
downloadbrew-ae57057afae0a714143de090a62ea772b097569c.tar.bz2
help: use Commands module.
Diffstat (limited to 'Library/Homebrew/cmd/help.rb')
-rw-r--r--Library/Homebrew/cmd/help.rb16
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?