Skip to content

Derive service completions from Cellar paths - #24009

Merged
MikeMcQuaid merged 2 commits into
mainfrom
service-completions
Sep 17, 2026
Merged

MikeMcQuaid merged 2 commits into
mainfrom
service-completions

Conversation

@p-linnane

Copy link
Copy Markdown
Contributor

brew services tab completion extracted the service name with awk -F'homebrew.|.service' '{print $3}'. That regex only worked for the legacy homebrew.<name> files under /opt/homebrew, where the prefix supplied the extra match. It completes nothing for the current sh.brew.<name> files, for custom service names, and for any prefix without homebrew in its path such as /usr/local or Linuxbrew.

The Bash, fish and zsh completers now take the formula name from the Cellar directory ($(NF-2) of the path) and deduplicate with sort -u, so multiple installed versions of a formula produce one entry. The generated completions are regenerated from the templates.

To reproduce: brew install postgresql@18, then brew services start and press tab. Nothing is completed before this change.

Fixes #24006


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Code (Fable 5.1) drafted the implementation and tests; I reviewed the diff, verified the new test fails without the fix and passes with it, and ran brew lgtm --online plus targeted specs.


Signed-off-by: Patrick Linnane <patrick@linnane.io>
Copilot AI lite review requested due to automatic review settings September 17, 2026 01:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Sep 17, 2026
Merged via the queue into main with commit a934330 Sep 17, 2026
82 of 83 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the service-completions branch September 17, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell completions do not look for the new launchd plist names

3 participants

⌂ 换网址