Skip to content

Commit

Permalink
deps: accept formula options.
Browse files Browse the repository at this point in the history
Also, cleanup usage of `<formula>`.

As requested in comments of #5587.
  • Loading branch information
MikeMcQuaid committed Jan 30, 2019
1 parent 0f270d8 commit 51a260c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 26 deletions.
34 changes: 19 additions & 15 deletions Library/Homebrew/cmd/deps.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] <formulae>:
#: Show dependencies for <formulae>. When given multiple formula arguments,
#: show the intersection of dependencies for <formulae>.
#: * `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] <formula>:
#: Show dependencies for <formula>. When given multiple formula arguments,
#: show the intersection of dependencies for every formula.
#:
#: If `--1` is passed, only show dependencies one level down, instead of
#: recursing.
#:
#: 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.
#:
#: If `--full-name` is passed, list dependencies by their full name.
Expand All @@ -16,13 +16,13 @@
#: currently installed.
#:
#: 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
#: `--include-test` to include (non-recursive) `:test` dependencies.
#: To skip `:recommended` type dependencies, pass `--skip-recommended`.
#: 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
#: individual trees for every formula.
#:
Expand All @@ -45,6 +45,9 @@
#: The <filters> placeholder is any combination of options `--include-build`,
#: `--include-optional`, `--include-test`, and `--skip-recommended` as
#: 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`,
# but only list dependencies for specified formula, one specified formula per line.
Expand All @@ -62,33 +65,33 @@ module Homebrew
def deps_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`deps` [<options>] <formulae>
`deps` [<options>] <formula>
Show dependencies for <formulae>. When given multiple formula arguments,
show the intersection of dependencies for <formulae>.
Show dependencies for <formula>. When given multiple formula arguments,
show the intersection of dependencies for <formula>.
EOS
switch "--1",
description: "Only show dependencies one level down, instead of recursing."
switch "-n",
description: "Show dependencies in topological order."
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",
description: "List dependencies by their full name."
switch "--installed",
description: "Only list those dependencies that are currently installed."
switch "--all",
description: "List all the dependencies for all available formuale."
switch "--include-build",
description: "Show `:build` type dependencies for <formulae>."
description: "Show `:build` type dependencies for <formula>."
switch "--include-optional",
description: "Show `:optional` dependecies for <formulae>."
description: "Show `:optional` dependecies for <formula>."
switch "--include-test",
description: "Show `:test` dependencies for <formulae> (non-recursive)."
description: "Show `:test` dependencies for <formula> (non-recursive)."
switch "--skip-recommended",
description: "Skip `:recommended` type dependencies for <formulae>."
description: "Skip `:recommended` type dependencies for <formula>."
switch "--include-requirements",
description: "Include requirements in addition to dependencies for <formulae>."
description: "Include requirements in addition to dependencies for <formula>."
switch "--tree",
description: "Show dependencies as a tree. When given multiple formula arguments "\
"output individual trees for every formula."
Expand All @@ -99,6 +102,7 @@ def deps_args
switch :verbose
switch :debug
conflicts "--installed", "--all"
formula_options
end
end

Expand Down
15 changes: 9 additions & 6 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
provide it.

* `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] *`formulae`*:
Show dependencies for *`formulae`*. When given multiple formula arguments,
show the intersection of dependencies for *`formulae`*.
* `deps` [`--1`] [`-n`] [`--union`] [`--full-name`] [`--installed`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--include-requirements`] *`formula`*:
Show dependencies for *`formula`*. When given multiple formula arguments,
show the intersection of dependencies for every formula.

If `--1` is passed, only show dependencies one level down, instead of
recursing.

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.

If `--full-name` is passed, list dependencies by their full name.
Expand All @@ -97,13 +97,13 @@ these flags should only appear after a command.
currently installed.

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
`--include-test` to include (non-recursive) `:test` dependencies.
To skip `:recommended` type dependencies, pass `--skip-recommended`.
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
individual trees for every formula.

Expand All @@ -127,6 +127,9 @@ these flags should only appear after a command.
`--include-optional`, `--include-test`, and `--skip-recommended` as
documented above.

Additional options specific to *`formula`* may be appended to the command,
and can be listed with `brew options` *`formula`*.

* `desc` *`formula`*:
Display *`formula`*'s name and one-line description.

Expand Down
13 changes: 8 additions & 5 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -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\.
.
.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
Show dependencies for \fIformulae\fR\. When given multiple formula arguments, show the intersection of dependencies for \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 \fIformula\fR\. When given multiple formula arguments, show the intersection of dependencies for every formula\.
.
.IP
If \fB\-\-1\fR is passed, only show dependencies one level down, instead of recursing\.
Expand All @@ -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\.
.
.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
If \fB\-\-full\-name\fR is passed, list dependencies by their full name\.
Expand All @@ -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\.
.
.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
\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\.
.
.IP
Expand All @@ -132,6 +132,9 @@ Show dependencies for installed or all available formulae\. Every line of output
.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\.
.
.IP
Additional options specific to \fIformula\fR may be appended to the command, and can be listed with \fBbrew options\fR \fIformula\fR\.
.
.TP
\fBdesc\fR \fIformula\fR
Display \fIformula\fR\'s name and one\-line description\.
Expand Down

0 comments on commit 51a260c

Please sign in to comment.