aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAdam Vandenberg2009-11-16 23:12:24 -0800
committerAdam Vandenberg2009-11-19 14:03:07 -0800
commit7366a412681384df9716499f737e90d8bad03d84 (patch)
treee50bc985770e7fb3b62d6dade33140356158117b /bin
parent56f82a33b1412a79e8519f3debe9fdb8b581776d (diff)
downloadbrew-7366a412681384df9716499f737e90d8bad03d84.tar.bz2
New command 'brew deps [formula]'
Where brew info will show the next-level-down dependencies, brew deps will show all of the formulae that a given formula depends on.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/brew29
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/brew b/bin/brew
index adc5e51c1..1151d88cc 100755
--- a/bin/brew
+++ b/bin/brew
@@ -246,6 +246,35 @@ begin
puts "#{name} is a dependency for #{our_deps.join(', ')}."
end
end
+
+ when 'deps'
+ require 'formula'
+
+ ARGV.formulae.each do |f|
+ name = f.name
+
+ our_deps = []
+ checked = {}
+ to_check = [name]
+
+ while ! to_check.empty?
+ item = to_check.pop
+ checked[item] = true
+
+ formula = Formulary.read item
+ next if formula == nil || formula.deps == nil || formula.deps.empty?
+
+ our_deps.push(*formula.deps)
+ to_check.push(*formula.deps.select{|g| !checked[g]})
+ end
+
+ if our_deps.empty?
+ puts "#{name} has no dependencies."
+ else
+ our_deps.sort!
+ puts "#{name} depends on #{our_deps.join(", ")}"
+ end
+ end
when 'pull', 'push', 'checkout', 'branch'
onoe "Unknown command: #{arg} (did you mean 'git #{arg}'?)"