deps: accept formula options.

Also, cleanup usage of `<formula>`.

As requested in comments of #5587.
This commit is contained in:
Mike McQuaid 2019-01-30 13:18:02 +00:00
parent 0f270d8115
commit 51a260cf1c
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
3 changed files with 36 additions and 26 deletions

View File

@ -1,13 +1,13 @@
#: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] <formulae>: #: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] <formula>:
#: Show dependencies for <formulae>. When given multiple formula arguments, #: Show dependencies for <formula>. When given multiple formula arguments,
#: show the intersection of dependencies for <formulae>. #: show the intersection of dependencies for every formula.
#: #:
#: If `--1` is passed, only show dependencies one level down, instead of #: If `--1` is passed, only show dependencies one level down, instead of
#: recursing. #: recursing.
#: #:
#: If `-n` is passed, show dependencies in topological order. #: If `-n` is passed, show dependencies in topological order.
#: #:
#: If `--union` is passed, show the union of dependencies for <formulae>, #: If `--union` is passed, show the union of dependencies for <formula>,
#: instead of the intersection. #: instead of the intersection.
#: #:
#: If `--full-name` is passed, list dependencies by their full name. #: If `--full-name` is passed, list dependencies by their full name.
@ -16,13 +16,13 @@
#: currently installed. #: currently installed.
#: #:
#: By default, `deps` shows required and recommended dependencies for #: By default, `deps` shows required and recommended dependencies for
#: <formulae>. To include the `:build` type dependencies, pass `--include-build`. #: <formula>. To include the `:build` type dependencies, pass `--include-build`.
#: Similarly, pass `--include-optional` to include `:optional` dependencies or #: Similarly, pass `--include-optional` to include `:optional` dependencies or
#: `--include-test` to include (non-recursive) `:test` dependencies. #: `--include-test` to include (non-recursive) `:test` dependencies.
#: To skip `:recommended` type dependencies, pass `--skip-recommended`. #: To skip `:recommended` type dependencies, pass `--skip-recommended`.
#: To include requirements in addition to dependencies, pass `--include-requirements`. #: To include requirements in addition to dependencies, pass `--include-requirements`.
#: #:
#: * `deps` `--tree` [`--1`] [<filters>] [`--annotate`] (<formulae>|`--installed`): #: * `deps` `--tree` [`--1`] [<filters>] [`--annotate`] (<formula>|`--installed`):
#: Show dependencies as a tree. When given multiple formula arguments, output #: Show dependencies as a tree. When given multiple formula arguments, output
#: individual trees for every formula. #: individual trees for every formula.
#: #:
@ -45,6 +45,9 @@
#: The <filters> placeholder is any combination of options `--include-build`, #: The <filters> placeholder is any combination of options `--include-build`,
#: `--include-optional`, `--include-test`, and `--skip-recommended` as #: `--include-optional`, `--include-test`, and `--skip-recommended` as
#: documented above. #: documented above.
#:
#: Additional options specific to <formula> may be appended to the command,
#: and can be listed with `brew options` <formula>.
# The undocumented `--for-each` option will switch into the mode used by `deps --all`, # The undocumented `--for-each` option will switch into the mode used by `deps --all`,
# but only list dependencies for specified formula, one specified formula per line. # but only list dependencies for specified formula, one specified formula per line.
@ -62,17 +65,17 @@ module Homebrew
def deps_args def deps_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`deps` [<options>] <formulae> `deps` [<options>] <formula>
Show dependencies for <formulae>. When given multiple formula arguments, Show dependencies for <formula>. When given multiple formula arguments,
show the intersection of dependencies for <formulae>. show the intersection of dependencies for <formula>.
EOS EOS
switch "--1", switch "--1",
description: "Only show dependencies one level down, instead of recursing." description: "Only show dependencies one level down, instead of recursing."
switch "-n", switch "-n",
description: "Show dependencies in topological order." description: "Show dependencies in topological order."
switch "--union", switch "--union",
description: "Show the union of dependencies for <formulae>, instead of the intersection." description: "Show the union of dependencies for <formula>, instead of the intersection."
switch "--full-name", switch "--full-name",
description: "List dependencies by their full name." description: "List dependencies by their full name."
switch "--installed", switch "--installed",
@ -80,15 +83,15 @@ module Homebrew
switch "--all", switch "--all",
description: "List all the dependencies for all available formuale." description: "List all the dependencies for all available formuale."
switch "--include-build", switch "--include-build",
description: "Show `:build` type dependencies for <formulae>." description: "Show `:build` type dependencies for <formula>."
switch "--include-optional", switch "--include-optional",
description: "Show `:optional` dependecies for <formulae>." description: "Show `:optional` dependecies for <formula>."
switch "--include-test", switch "--include-test",
description: "Show `:test` dependencies for <formulae> (non-recursive)." description: "Show `:test` dependencies for <formula> (non-recursive)."
switch "--skip-recommended", switch "--skip-recommended",
description: "Skip `:recommended` type dependencies for <formulae>." description: "Skip `:recommended` type dependencies for <formula>."
switch "--include-requirements", switch "--include-requirements",
description: "Include requirements in addition to dependencies for <formulae>." description: "Include requirements in addition to dependencies for <formula>."
switch "--tree", switch "--tree",
description: "Show dependencies as a tree. When given multiple formula arguments "\ description: "Show dependencies as a tree. When given multiple formula arguments "\
"output individual trees for every formula." "output individual trees for every formula."
@ -99,6 +102,7 @@ module Homebrew
switch :verbose switch :verbose
switch :debug switch :debug
conflicts "--installed", "--all" conflicts "--installed", "--all"
formula_options
end end
end end

View File

@ -79,16 +79,16 @@ these flags should only appear after a command.
a bug report, you will likely be asked for this information if you do not a bug report, you will likely be asked for this information if you do not
provide it. provide it.
* `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] *`formulae`*: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] *`formula`*:
Show dependencies for *`formulae`*. When given multiple formula arguments, Show dependencies for *`formula`*. When given multiple formula arguments,
show the intersection of dependencies for *`formulae`*. show the intersection of dependencies for every formula.
If `--1` is passed, only show dependencies one level down, instead of If `--1` is passed, only show dependencies one level down, instead of
recursing. recursing.
If `-n` is passed, show dependencies in topological order. If `-n` is passed, show dependencies in topological order.
If `--union` is passed, show the union of dependencies for *`formulae`*, If `--union` is passed, show the union of dependencies for *`formula`*,
instead of the intersection. instead of the intersection.
If `--full-name` is passed, list dependencies by their full name. If `--full-name` is passed, list dependencies by their full name.
@ -97,13 +97,13 @@ these flags should only appear after a command.
currently installed. currently installed.
By default, `deps` shows required and recommended dependencies for By default, `deps` shows required and recommended dependencies for
*`formulae`*. To include the `:build` type dependencies, pass `--include-build`. *`formula`*. To include the `:build` type dependencies, pass `--include-build`.
Similarly, pass `--include-optional` to include `:optional` dependencies or Similarly, pass `--include-optional` to include `:optional` dependencies or
`--include-test` to include (non-recursive) `:test` dependencies. `--include-test` to include (non-recursive) `:test` dependencies.
To skip `:recommended` type dependencies, pass `--skip-recommended`. To skip `:recommended` type dependencies, pass `--skip-recommended`.
To include requirements in addition to dependencies, pass `--include-requirements`. To include requirements in addition to dependencies, pass `--include-requirements`.
* `deps` `--tree` [`--1`] [*`filters`*] [`--annotate`] (*`formulae`*|`--installed`): * `deps` `--tree` [`--1`] [*`filters`*] [`--annotate`] (*`formula`*|`--installed`):
Show dependencies as a tree. When given multiple formula arguments, output Show dependencies as a tree. When given multiple formula arguments, output
individual trees for every formula. individual trees for every formula.
@ -127,6 +127,9 @@ these flags should only appear after a command.
`--include-optional`, `--include-test`, and `--skip-recommended` as `--include-optional`, `--include-test`, and `--skip-recommended` as
documented above. documented above.
Additional options specific to *`formula`* may be appended to the command,
and can be listed with `brew options` *`formula`*.
* `desc` *`formula`*: * `desc` *`formula`*:
Display *`formula`*'s name and one-line description. Display *`formula`*'s name and one-line description.

View File

@ -88,8 +88,8 @@ If \fB\-\-quiet\fR is passed, list only the names of commands without the header
Show Homebrew and system configuration useful for debugging\. If you file a bug report, you will likely be asked for this information if you do not provide it\. Show Homebrew and system configuration useful for debugging\. If you file a bug report, you will likely be asked for this information if you do not provide it\.
. .
.TP .TP
\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] [\fB\-\-include\-requirements\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] [\fB\-\-include\-requirements\fR] \fIformula\fR
Show dependencies for \fIformulae\fR\. When given multiple formula arguments, show the intersection of dependencies for \fIformulae\fR\. Show dependencies for \fIformula\fR\. When given multiple formula arguments, show the intersection of dependencies for every formula\.
. .
.IP .IP
If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recursing\. If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recursing\.
@ -98,7 +98,7 @@ 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\-\-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 \fIformula\fR, instead of the intersection\.
. .
.IP .IP
If \fB\-\-full\-name\fR is passed, list dependencies by their full name\. If \fB\-\-full\-name\fR is passed, list dependencies by their full name\.
@ -107,10 +107,10 @@ If \fB\-\-full\-name\fR is passed, list dependencies by their full name\.
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
By default, \fBdeps\fR shows required and recommended dependencies for \fIformulae\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies or \fB\-\-include\-test\fR to include (non\-recursive) \fB:test\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\. By default, \fBdeps\fR shows required and recommended dependencies for \fIformula\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies or \fB\-\-include\-test\fR to include (non\-recursive) \fB:test\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\.
. .
.TP .TP
\fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformulae\fR|\fB\-\-installed\fR) \fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformula\fR|\fB\-\-installed\fR)
Show dependencies as a tree\. When given multiple formula arguments, output individual trees for every formula\. Show dependencies as a tree\. When given multiple formula arguments, output individual trees for every formula\.
. .
.IP .IP
@ -132,6 +132,9 @@ Show dependencies for installed or all available formulae\. Every line of output
.IP .IP
The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, and \fB\-\-skip\-recommended\fR as documented above\. The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, and \fB\-\-skip\-recommended\fR as documented above\.
. .
.IP
Additional options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\.
.
.TP .TP
\fBdesc\fR \fIformula\fR \fBdesc\fR \fIformula\fR
Display \fIformula\fR\'s name and one\-line description\. Display \fIformula\fR\'s name and one\-line description\.