aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/command.rb
diff options
context:
space:
mode:
authorMike McQuaid2016-09-09 08:30:26 +0100
committerGitHub2016-09-09 08:30:26 +0100
commit930bcb7c52523a1e03a1de132192ad4cdd74ce7a (patch)
treec91de0dfb23f75507005deccbc1cd51458aad66d /Library/Homebrew/cmd/command.rb
parent1d66cdd3ade841c6b7cd8a71d4b71d5426d00a58 (diff)
parent027086d67386a58b06f3df92b9168dcb0319ef0e (diff)
downloadbrew-930bcb7c52523a1e03a1de132192ad4cdd74ce7a.tar.bz2
Merge pull request #881 from MikeMcQuaid/dev-cmd-sticky-homebrew-developer
Set HOMEBREW_DEVELOPER automatically
Diffstat (limited to 'Library/Homebrew/cmd/command.rb')
-rw-r--r--Library/Homebrew/cmd/command.rb17
1 files changed, 3 insertions, 14 deletions
diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb
index 8c8a8c699..b76468f62 100644
--- a/Library/Homebrew/cmd/command.rb
+++ b/Library/Homebrew/cmd/command.rb
@@ -1,13 +1,15 @@
#: * `command` <cmd>:
#: Display the path to the file which is used when invoking `brew` <cmd>.
+require "commands"
+
module Homebrew
def command
abort "This command requires a command argument" if ARGV.empty?
cmd = ARGV.first
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)
- if (path = internal_command_path cmd)
+ if (path = Commands.path(cmd))
puts path
elsif (path = which("brew-#{cmd}") || which("brew-#{cmd}.rb"))
puts path
@@ -15,17 +17,4 @@ module Homebrew
odie "Unknown command: #{cmd}"
end
end
-
- private
-
- def internal_command_path(cmd)
- extensions = %w[rb sh]
- paths = extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.#{ext}" }
-
- if ARGV.homebrew_developer?
- paths += extensions.map { |ext| HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.#{ext}" }
- end
-
- paths.find { |p| p.file? }
- end
end