cmd/deps: accept --brewfile as an input source#23104
Merged
Merged
Conversation
Read brew and cask entries from a Brewfile and treat them as if they had been passed as named arguments, so --brewfile composes with --tree, --graph, --for-each, --union and the default flat listing. --formula and --cask filter which entry types are loaded. A bare --brewfile reads ./Brewfile and --brewfile=<path> reads a specific file, matching brew vulns.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds --brewfile support to brew deps, allowing dependency output modes (--tree, --graph, --for-each, --union, and default listing) to use formulae/casks from a Brewfile as inputs, similar to brew vulns.
Changes:
- Add
--brewfileflag tobrew depsand load formula/cask entries from a Brewfile as command inputs. - Add an integration spec covering
--brewfile=<path>. - Update manpage/docs and shell completions to document the new flag.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
Library/Homebrew/cmd/deps.rb |
Implements --brewfile flag and Brewfile-driven input loading for dependency calculation/output. |
Library/Homebrew/test/cmd/deps_spec.rb |
Adds an integration test verifying --brewfile=<path> behavior with --tree. |
Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/deps.rbi |
Adds the brewfile args accessor to the generated RBI for brew deps. |
manpages/brew.1 |
Documents brew deps --brewfile in the main manpage. |
docs/Manpage.md |
Documents brew deps --brewfile in the Markdown manpage source. |
completions/zsh/_brew |
Adds --brewfile to zsh completions for brew deps. |
completions/fish/brew.fish |
Adds --brewfile to fish completions for brew deps. |
completions/bash/brew |
Adds --brewfile to bash completions for brew deps. |
Files not reviewed (1)
- Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/deps.rbi: File type not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Previously --brewfile silently replaced any named arguments; combine them instead so `brew deps foo --brewfile` includes foo alongside the Brewfile entries, and dedupe the merged list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--brewfiletobrew deps, matching the flag onbrew vulns.brewandcaskentries from the Brewfile are treated as if they'd been passed as named arguments, so the flag composes with--tree,--graph,--for-each,--unionand the default flat listing.--formula/--caskfilter which entry types are loaded;tap,masand other extension entries are ignored.A bare
--brewfilereads./Brewfile;--brewfile=<path>reads a specific file.Motivation: seeing what a Brewfile will pull in before running
brew bundle, and inspecting a project's toolchain footprint in CI without installing anything.The
brewfile_pathnormalisation helper is copied fromcmd/vulns.rb; happy to extract it if a third command grows the same flag.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Written with Claude Code; I read the diff, exercised
--tree,--graph --dot,--for-each,--union, and--formula/--caskfiltering against a local Brewfile, and ranbrew lgtmlocally.