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).
This commit is contained in:
Adam Vandenberg 2010-08-11 20:51:33 -07:00
parent 64cf554a7b
commit 77c70ec472
3 changed files with 22 additions and 8 deletions

View File

@ -129,12 +129,18 @@ didn't include with OS X.
* `outdated`: * `outdated`:
Shows formula that have an updated version available. Shows formula that have an updated version available.
* `deps` <formula>: * `deps [--1]` <formula>:
Shows <formula>'s dependencies. Shows <formula>'s dependencies.
* `uses` <formula>: If `--1` is passed, only show dependencies one level down, instead of
Shows the formulas that specify <formula> as a dependency. The list is not recursing.
recursive; only one level of dependencies is resolved.
* `uses [--installed]` <formula>:
Shows the formulas that specify <formula> 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`: * `doctor`:
Checks your system for potential problems. Checks your system for potential problems.

View File

@ -258,7 +258,9 @@ begin
# For each formula given, show which other formulas depend on it. # For each formula given, show which other formulas depend on it.
# We only go one level up, ie. direct dependencies. # We only go one level up, ie. direct dependencies.
when 'uses' 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' when 'deps'
require 'formula_installer' require 'formula_installer'

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.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" .SH "NAME"
\fBbrew\fR \- The missing package manager for OS X \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\. Shows formula that have an updated version available\.
. .
.TP .TP
\fBdeps\fR \fIformula\fR \fBdeps [\-\-1]\fR \fIformula\fR
Shows \fIformula\fR\'s dependencies\. Shows \fIformula\fR\'s dependencies\.
. .
.IP
If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recursing\.
.
.TP .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\. 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 .TP
\fBdoctor\fR \fBdoctor\fR
Checks your system for potential problems\. Checks your system for potential problems\.