Move brew-depstree into brew deps --tree
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
0d08a5af00
commit
8b88ea3eae
@ -85,7 +85,7 @@ _brew_to_completion()
|
|||||||
;;
|
;;
|
||||||
deps)
|
deps)
|
||||||
local opts=$(
|
local opts=$(
|
||||||
local opts=(--1 --all)
|
local opts=(--1 --all --tree)
|
||||||
for o in ${opts[*]}; do
|
for o in ${opts[*]}; do
|
||||||
[[ "${COMP_WORDS[*]}" =~ "$o" ]] || echo "$o"
|
[[ "${COMP_WORDS[*]}" =~ "$o" ]] || echo "$o"
|
||||||
done
|
done
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
require 'formula'
|
|
||||||
|
|
||||||
module Homebrew extend self
|
|
||||||
def depstree
|
|
||||||
ARGV.formulae.each do |f|
|
|
||||||
puts f
|
|
||||||
recursive_deps_tree(f, 1)
|
|
||||||
puts
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
def recursive_deps_tree(formula, level)
|
|
||||||
formula.deps.each do |dep|
|
|
||||||
puts "> "*level+dep
|
|
||||||
recursive_deps_tree(Formula.factory(dep), level+1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Homebrew.depstree
|
|
@ -72,7 +72,7 @@ For the full command list, see the COMMANDS section.
|
|||||||
If `--no-fetch` is passed, Homebrew will not download <URL> to the cache and
|
If `--no-fetch` is passed, Homebrew will not download <URL> to the cache and
|
||||||
will thus not add the MD5 to the formula for you.
|
will thus not add the MD5 to the formula for you.
|
||||||
|
|
||||||
* `deps [--1] [-n] [--all]` <formula>:
|
* `deps [--1] [-n] [--tree] [--all]` <formula>:
|
||||||
Show <formula>'s dependencies.
|
Show <formula>'s dependencies.
|
||||||
|
|
||||||
If `--1` is passed, only show dependencies one level down, instead of
|
If `--1` is passed, only show dependencies one level down, instead of
|
||||||
@ -80,6 +80,8 @@ For the full command list, see the COMMANDS section.
|
|||||||
|
|
||||||
If `-n` is passed, show dependencies in topological order.
|
If `-n` is passed, show dependencies in topological order.
|
||||||
|
|
||||||
|
If `--tree` is passed, show dependencies as a tree.
|
||||||
|
|
||||||
If `--all` is passed, show dependencies for all formulae.
|
If `--all` is passed, show dependencies for all formulae.
|
||||||
|
|
||||||
* `diy [--set-name] [--set-version]`:
|
* `diy [--set-name] [--set-version]`:
|
||||||
|
@ -1,11 +1,24 @@
|
|||||||
require 'formula'
|
require 'formula'
|
||||||
|
|
||||||
|
def recursive_deps_tree f, level
|
||||||
|
f.deps.each do |dep|
|
||||||
|
puts "> "*level+dep
|
||||||
|
recursive_deps_tree(Formula.factory(dep), level+1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
def deps
|
def deps
|
||||||
if ARGV.include? '--all'
|
if ARGV.include? '--all'
|
||||||
Formula.each do |f|
|
Formula.each do |f|
|
||||||
puts "#{f.name}: #{f.deps*' '}"
|
puts "#{f.name}: #{f.deps*' '}"
|
||||||
end
|
end
|
||||||
|
elsif ARGV.include? '--tree'
|
||||||
|
ARGV.formulae.each do |f|
|
||||||
|
puts f
|
||||||
|
recursive_deps_tree(f, 1)
|
||||||
|
puts
|
||||||
|
end
|
||||||
else
|
else
|
||||||
all_deps = ARGV.formulae.map{ |f| ARGV.one? ? f.deps : f.recursive_deps }.intersection
|
all_deps = ARGV.formulae.map{ |f| ARGV.one? ? f.deps : f.recursive_deps }.intersection
|
||||||
all_deps.sort! unless ARGV.include? "-n"
|
all_deps.sort! unless ARGV.include? "-n"
|
||||||
|
@ -81,7 +81,7 @@ If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-styl
|
|||||||
If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the MD5 to the formula for you\.
|
If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the MD5 to the formula for you\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBdeps [\-\-1] [\-n] [\-\-all]\fR \fIformula\fR
|
\fBdeps [\-\-1] [\-n] [\-\-tree] [\-\-all]\fR \fIformula\fR
|
||||||
Show \fIformula\fR\'s dependencies\.
|
Show \fIformula\fR\'s dependencies\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
@ -91,6 +91,9 @@ If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recu
|
|||||||
If \fB\-n\fR is passed, show dependencies in topological order\.
|
If \fB\-n\fR is passed, show dependencies in topological order\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
|
If \fB\-\-tree\fR is passed, show dependencies as a tree\.
|
||||||
|
.
|
||||||
|
.IP
|
||||||
If \fB\-\-all\fR is passed, show dependencies for all formulae\.
|
If \fB\-\-all\fR is passed, show dependencies for all formulae\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user