diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Contributions/brew_bash_completion.sh | 2 | ||||
| -rwxr-xr-x | Library/Contributions/examples/brew-depstree.rb | 21 | ||||
| -rw-r--r-- | Library/Contributions/manpages/brew.1.md | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/deps.rb | 13 |
4 files changed, 17 insertions, 23 deletions
diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh index 6fe0c1af4..722083e6f 100644 --- a/Library/Contributions/brew_bash_completion.sh +++ b/Library/Contributions/brew_bash_completion.sh @@ -85,7 +85,7 @@ _brew_to_completion() ;; deps) local opts=$( - local opts=(--1 --all) + local opts=(--1 --all --tree) for o in ${opts[*]}; do [[ "${COMP_WORDS[*]}" =~ "$o" ]] || echo "$o" done diff --git a/Library/Contributions/examples/brew-depstree.rb b/Library/Contributions/examples/brew-depstree.rb deleted file mode 100755 index f8d6989b1..000000000 --- a/Library/Contributions/examples/brew-depstree.rb +++ /dev/null @@ -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 diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md index 84f0864e9..ba7b1df4b 100644 --- a/Library/Contributions/manpages/brew.1.md +++ b/Library/Contributions/manpages/brew.1.md @@ -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 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. 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 `--tree` is passed, show dependencies as a tree. + If `--all` is passed, show dependencies for all formulae. * `diy [--set-name] [--set-version]`: diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index eed04ae0f..9bba1ef39 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -1,11 +1,24 @@ 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 def deps if ARGV.include? '--all' Formula.each do |f| puts "#{f.name}: #{f.deps*' '}" end + elsif ARGV.include? '--tree' + ARGV.formulae.each do |f| + puts f + recursive_deps_tree(f, 1) + puts + end else all_deps = ARGV.formulae.map{ |f| ARGV.one? ? f.deps : f.recursive_deps }.intersection all_deps.sort! unless ARGV.include? "-n" |
