From 77c70ec47260e286e2b205d8bef3d1baebf1fb48 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Wed, 11 Aug 2010 20:51:33 -0700 Subject: [PATCH] Add "brew uses --installed" Passing --installed will limit the list to formulae that you have installed. Documented this and "brew deps --1" which limits the dependency list to one level down (direct dependencies). --- Library/Contributions/manpages/brew.1.md | 14 ++++++++++---- bin/brew | 4 +++- share/man/man1/brew.1 | 12 +++++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md index aefc5f7b6a..c4c645ebd4 100644 --- a/Library/Contributions/manpages/brew.1.md +++ b/Library/Contributions/manpages/brew.1.md @@ -129,12 +129,18 @@ didn't include with OS X. * `outdated`: Shows formula that have an updated version available. - * `deps` : + * `deps [--1]` : Shows 's dependencies. - * `uses` : - Shows the formulas that specify as a dependency. The list is not - recursive; only one level of dependencies is resolved. + If `--1` is passed, only show dependencies one level down, instead of + recursing. + + * `uses [--installed]` : + Shows the formulas that specify as a dependency. The list is + not recursive; only one level of dependencies is resolved. + + If `--installed` is passed, the list only shows formulae you have + installed. * `doctor`: Checks your system for potential problems. diff --git a/bin/brew b/bin/brew index c2b862e487..960829b585 100755 --- a/bin/brew +++ b/bin/brew @@ -258,7 +258,9 @@ begin # For each formula given, show which other formulas depend on it. # We only go one level up, ie. direct dependencies. when 'uses' - puts *ARGV.formulae.map{ |f| Formula.all.select{ |ff| ff.deps.include? f.name }.map{|f| f.name} }.flatten.uniq.sort + uses = ARGV.formulae.map{ |f| Formula.all.select{ |ff| ff.deps.include? f.name }.map{|f| f.name} }.flatten.uniq + uses = uses.select { |f| Formula.factory(f).installed? } if ARGV.include? "--installed" + puts *uses.sort when 'deps' require 'formula_installer' diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1 index 74d1192510..726bc98333 100644 --- a/share/man/man1/brew.1 +++ b/share/man/man1/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "July 2010" "Homebrew" "brew" +.TH "BREW" "1" "August 2010" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for OS X @@ -141,13 +141,19 @@ Removes dead symlinks from the Homebrew prefix\. This is generally not needed\. Shows formula that have an updated version available\. . .TP -\fBdeps\fR \fIformula\fR +\fBdeps [\-\-1]\fR \fIformula\fR Shows \fIformula\fR\'s dependencies\. . +.IP +If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recursing\. +. .TP -\fBuses\fR \fIformula\fR +\fBuses [\-\-installed]\fR \fIformula\fR Shows the formulas that specify \fIformula\fR as a dependency\. The list is not recursive; only one level of dependencies is resolved\. . +.IP +If \fB\-\-installed\fR is passed, the list only shows formulae you have installed\. +. .TP \fBdoctor\fR Checks your system for potential problems\.