-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Add source command to open formulae source repositories
#21339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new brew source command to open formula source repositories directly in a browser, complementing the existing brew home command which opens project homepages. The implementation extracts repository URLs from formula metadata and supports GitHub, GitLab, Bitbucket, Codeberg, and SourceHut.
Key Changes:
- Adds repository URL extraction logic with regex patterns for five major hosting platforms
- Implements fallback strategy checking head URL, stable URL, and homepage in sequence
- Includes test coverage for basic GitHub scenarios and error handling
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| Library/Homebrew/cmd/source.rb | Core command implementation with URL extraction methods for each supported platform |
| Library/Homebrew/test/cmd/source_spec.rb | Test suite covering GitHub URLs and error cases when repository cannot be determined |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
23e7489 to
4ae6d70
Compare
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looking good so far!
4ae6d70 to
aac92dc
Compare
Signed-off-by: Patrick Linnane <patrick@linnane.io>
aac92dc to
e8c8557
Compare
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
brew lgtm(style, typechecking and tests) with your changes locally?This PR adds a new
sourcecommand to open source repositories similar to howhomeopens homepages. Formulae homepages are often upstream marketing sites or documentation pages, which require extra work to get to the repository. The command extracts the repository URL from the formula's head URL, stable URL, or homepage. This initial implementation supports GitHub, GitLab, Bitbucket, Codeberg, and SourceHut.