Merge pull request #830 from scpeters/deps_cmd_full_name

Add `--full-name` option to `brew deps`
This commit is contained in:
Mike McQuaid 2016-08-30 20:17:07 +01:00 committed by GitHub
commit 8bf787c94d
4 changed files with 16 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#: * `deps` [`--1`] [`-n`] [`--union`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] <formulae>: #: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] <formulae>:
#: Show dependencies for <formulae>. When given multiple formula arguments, #: Show dependencies for <formulae>. When given multiple formula arguments,
#: show the intersection of dependencies for <formulae>. #: show the intersection of dependencies for <formulae>.
#: #:
@ -10,6 +10,8 @@
#: If `--union` is passed, show the union of dependencies for <formulae>, #: If `--union` is passed, show the union of dependencies for <formulae>,
#: instead of the intersection. #: instead of the intersection.
#: #:
#: If `--full-name` is passed, list dependencies by their full name.
#:
#: If `--installed` is passed, only list those dependencies that are #: If `--installed` is passed, only list those dependencies that are
#: currently installed. #: currently installed.
#: #:
@ -62,7 +64,11 @@ module Homebrew
else else
all_deps = deps_for_formulae(ARGV.formulae, !ARGV.one?, &(mode.union? ? :| : :&)) all_deps = deps_for_formulae(ARGV.formulae, !ARGV.one?, &(mode.union? ? :| : :&))
all_deps = all_deps.select(&:installed?) if mode.installed? all_deps = all_deps.select(&:installed?) if mode.installed?
all_deps = all_deps.map(&:name).uniq all_deps = if ARGV.include? "--full-name"
all_deps.map(&:to_formula).map(&:full_name)
else
all_deps.map(&:name)
end.uniq
all_deps.sort! unless mode.topo_order? all_deps.sort! unless mode.topo_order?
puts all_deps puts all_deps
end end

View File

@ -753,7 +753,7 @@ module Homebrew
changed_formulae_dependents = {} changed_formulae_dependents = {}
@formulae.each do |formula| @formulae.each do |formula|
formula_dependencies = Utils.popen_read("brew", "deps", "--include-build", formula).split("\n") formula_dependencies = Utils.popen_read("brew", "deps", "--full-name", "--include-build", formula).split("\n")
unchanged_dependencies = formula_dependencies - @formulae unchanged_dependencies = formula_dependencies - @formulae
changed_dependences = formula_dependencies - unchanged_dependencies changed_dependences = formula_dependencies - unchanged_dependencies
changed_dependences.each do |changed_formula| changed_dependences.each do |changed_formula|

View File

@ -100,7 +100,7 @@ you to explicitly set the name and version of the package you are creating.</p>
<p>The option <code>--tap</code> takes a tap as its argument and generates the formula in <p>The option <code>--tap</code> takes a tap as its argument and generates the formula in
the specified tap.</p></dd> the specified tap.</p></dd>
<dt><code>deps</code> [<code>--1</code>] [<code>-n</code>] [<code>--union</code>] [<code>--installed</code>] [<code>--include-build</code>] [<code>--include-optional</code>] [<code>--skip-recommended</code>] <var>formulae</var></dt><dd><p>Show dependencies for <var>formulae</var>. When given multiple formula arguments, <dt><code>deps</code> [<code>--1</code>] [<code>-n</code>] [<code>--union</code>] [<code>--full-name</code>] [<code>--installed</code>] [<code>--include-build</code>] [<code>--include-optional</code>] [<code>--skip-recommended</code>] <var>formulae</var></dt><dd><p>Show dependencies for <var>formulae</var>. When given multiple formula arguments,
show the intersection of dependencies for <var>formulae</var>.</p> show the intersection of dependencies for <var>formulae</var>.</p>
<p>If <code>--1</code> is passed, only show dependencies one level down, instead of <p>If <code>--1</code> is passed, only show dependencies one level down, instead of
@ -111,6 +111,8 @@ recursing.</p>
<p>If <code>--union</code> is passed, show the union of dependencies for <var>formulae</var>, <p>If <code>--union</code> is passed, show the union of dependencies for <var>formulae</var>,
instead of the intersection.</p> instead of the intersection.</p>
<p>If <code>--full-name</code> is passed, list dependencies by their full name.</p>
<p>If <code>--installed</code> is passed, only list those dependencies that are <p>If <code>--installed</code> is passed, only list those dependencies that are
currently installed.</p> currently installed.</p>

View File

@ -132,7 +132,7 @@ The options \fB\-\-set\-name\fR and \fB\-\-set\-version\fR each take an argument
The option \fB\-\-tap\fR takes a tap as its argument and generates the formula in the specified tap\. The option \fB\-\-tap\fR takes a tap as its argument and generates the formula in the specified tap\.
. .
.TP .TP
\fBdeps\fR [\fB\-\-1\fR] [\fB\-n\fR] [\fB\-\-union\fR] [\fB\-\-installed\fR] [\fB\-\-include\-build\fR] [\fB\-\-include\-optional\fR] [\fB\-\-skip\-recommended\fR] \fIformulae\fR \fBdeps\fR [\fB\-\-1\fR] [\fB\-n\fR] [\fB\-\-union\fR] [\fB\-\-full\-name\fR] [\fB\-\-installed\fR] [\fB\-\-include\-build\fR] [\fB\-\-include\-optional\fR] [\fB\-\-skip\-recommended\fR] \fIformulae\fR
Show dependencies for \fIformulae\fR\. When given multiple formula arguments, show the intersection of dependencies for \fIformulae\fR\. Show dependencies for \fIformulae\fR\. When given multiple formula arguments, show the intersection of dependencies for \fIformulae\fR\.
. .
.IP .IP
@ -145,6 +145,9 @@ If \fB\-n\fR is passed, show dependencies in topological order\.
If \fB\-\-union\fR is passed, show the union of dependencies for \fIformulae\fR, instead of the intersection\. If \fB\-\-union\fR is passed, show the union of dependencies for \fIformulae\fR, instead of the intersection\.
. .
.IP .IP
If \fB\-\-full\-name\fR is passed, list dependencies by their full name\.
.
.IP
If \fB\-\-installed\fR is passed, only list those dependencies that are currently installed\. If \fB\-\-installed\fR is passed, only list those dependencies that are currently installed\.
. .
.IP .IP