brew missing: allow a formula argument
If a formula is given, it will be checked for missing deps. The formula does not have to be installed first. Without a formula list, still checks all installed brews.
This commit is contained in:
parent
bfd75db803
commit
94a524cce3
@ -28,7 +28,7 @@ _brew_to_completion()
|
|||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
# Commands that take a formula
|
# Commands that take a formula
|
||||||
cat|deps|edit|fetch|home|homepage|info|install|log|options|uses)
|
cat|deps|edit|fetch|home|homepage|info|install|log|missing|options|uses)
|
||||||
# handle standard --options
|
# handle standard --options
|
||||||
if [[ "$prev" == "install" && "$cur" == --* ]]; then
|
if [[ "$prev" == "install" && "$cur" == --* ]]; then
|
||||||
local opts=$(
|
local opts=$(
|
||||||
|
@ -1,18 +1,29 @@
|
|||||||
require "formula"
|
require "formula"
|
||||||
require "cmd/outdated"
|
require "cmd/outdated"
|
||||||
|
|
||||||
|
def installed_brews
|
||||||
|
formulae = []
|
||||||
|
HOMEBREW_CELLAR.subdirs.each do |rack|
|
||||||
|
f = Formula.factory rack.basename.to_s rescue nil
|
||||||
|
formulae << f if f and f.installed?
|
||||||
|
end
|
||||||
|
formulae
|
||||||
|
end
|
||||||
|
|
||||||
def main
|
def main
|
||||||
# Names of outdated brews; they count as installed.
|
# Names of outdated brews; they count as installed.
|
||||||
outdated = Homebrew.outdated_brews.collect{ |b| b[1] }
|
outdated = Homebrew.outdated_brews.collect{ |b| b[1] }
|
||||||
|
|
||||||
HOMEBREW_CELLAR.subdirs.each do |rack|
|
formuale_to_check = ARGV.formulae rescue installed_brews
|
||||||
f = Formula.factory rack.basename.to_s rescue nil
|
|
||||||
if f and f.installed?
|
formuale_to_check.each do |f|
|
||||||
missing_deps = f.recursive_deps.map{ |g| g.name }.uniq.reject do |dep_name|
|
missing_deps = f.recursive_deps.map{ |g| g.name }.uniq.reject do |dep_name|
|
||||||
Formula.factory(dep_name).installed? or outdated.include?(dep_name)
|
Formula.factory(dep_name).installed? or outdated.include?(dep_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "#{f.name}: #{missing_deps * ', '}" unless missing_deps.empty?
|
unless missing_deps.empty?
|
||||||
|
print "#{f.name}: " if formuale_to_check.size > 1
|
||||||
|
puts "#{missing_deps * ', '}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -179,8 +179,10 @@ didn't include with OS X.
|
|||||||
|
|
||||||
If `--all` is passed, show options for all formulae.
|
If `--all` is passed, show options for all formulae.
|
||||||
|
|
||||||
* `missing`:
|
* `missing` [<formulae>]:
|
||||||
Check all installed formuale for missing dependencies.
|
Check the given <formulae> for missing dependencies.
|
||||||
|
|
||||||
|
If no <formulae> are given, check all installed brews.
|
||||||
|
|
||||||
* `server`:
|
* `server`:
|
||||||
Start a local web app that lets you browse available formulae, similar
|
Start a local web app that lets you browse available formulae, similar
|
||||||
|
@ -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" "March 2011" "Homebrew" "brew"
|
.TH "BREW" "1" "April 2011" "Homebrew" "brew"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbrew\fR \- The missing package manager for OS X
|
\fBbrew\fR \- The missing package manager for OS X
|
||||||
@ -198,8 +198,11 @@ If \fB\-\-compact\fR is passed, show all options on a single line separated by s
|
|||||||
If \fB\-\-all\fR is passed, show options for all formulae\.
|
If \fB\-\-all\fR is passed, show options for all formulae\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBmissing\fR
|
\fBmissing\fR [\fIformulae\fR]
|
||||||
Check all installed formuale for missing dependencies\.
|
Check the given \fIformulae\fR for missing dependencies\.
|
||||||
|
.
|
||||||
|
.IP
|
||||||
|
If no \fIformulae\fR are given, check all installed brews\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBserver\fR
|
\fBserver\fR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user