diff options
| author | Mike McQuaid | 2016-09-09 08:30:26 +0100 |
|---|---|---|
| committer | GitHub | 2016-09-09 08:30:26 +0100 |
| commit | 930bcb7c52523a1e03a1de132192ad4cdd74ce7a (patch) | |
| tree | c91de0dfb23f75507005deccbc1cd51458aad66d /Library/Homebrew/cmd/command.rb | |
| parent | 1d66cdd3ade841c6b7cd8a71d4b71d5426d00a58 (diff) | |
| parent | 027086d67386a58b06f3df92b9168dcb0319ef0e (diff) | |
| download | brew-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.rb | 17 |
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 |
