aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/commands.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/commands.rb')
-rw-r--r--Library/Homebrew/commands.rb15
1 files changed, 6 insertions, 9 deletions
diff --git a/Library/Homebrew/commands.rb b/Library/Homebrew/commands.rb
index caf356b43..9f25f2a2e 100644
--- a/Library/Homebrew/commands.rb
+++ b/Library/Homebrew/commands.rb
@@ -1,13 +1,10 @@
module Commands
def self.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
+ [
+ HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.sh",
+ HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.sh",
+ HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb",
+ HOMEBREW_LIBRARY_PATH/"dev-cmd/#{cmd}.rb",
+ ].find(&:exist?)
end
end