From 868b4f8bea5f04de4c9036c4ca6e3697670225c3 Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Tue, 29 Oct 2013 17:27:36 -0400
Subject: [PATCH] uses: display requirements.

Closes Homebrew/homebrew#23758.
---
 Library/Homebrew/cmd/uses.rb | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index a9012dca58..be8e1609a6 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -10,20 +10,27 @@ module Homebrew extend self
 
     formulae = ARGV.formulae
 
-    uses = Formula.select do |f|
+    uses = []
+    Formula.each do |f|
+      next if ARGV.include? "--installed" and not f.installed?
+
       formulae.all? do |ff|
         if ARGV.flag? '--recursive'
-          f.recursive_dependencies.any? { |dep| dep.name == ff.name }
+          if f.recursive_dependencies.any? { |dep| dep.name == ff.name }
+            uses << f.to_s
+          elsif f.recursive_requirements.any? { |req| req.name == ff.name }
+            uses << ":#{f}"
+          end
         else
-          f.deps.any? { |dep| dep.name == ff.name }
+          if f.deps.any? { |dep| dep.name == ff.name }
+            uses << f.to_s
+          elsif f.requirements.any? { |req| req.name == ff.name }
+            uses << ":#{f}"
+          end
         end
       end
     end
 
-    if ARGV.include? "--installed"
-      uses = uses.select { |f| Formula.installed.include? f }
-    end
-
-    puts_columns uses.map(&:to_s).sort
+    puts_columns uses
   end
 end
-- 
GitLab