Repository navigation
feat: take descriptions from Homebrew instead of a hand-written catalog - #3
Merged
Merged
Conversation
`brew info --json=v2 --installed` returns the official description of
every installed formula and cask in one call. The hand-written catalog
duplicated them, and everything outside it had no description: 29
"Other" formulas and 5 casks ("GUI application") on a real machine.
- read descriptions from Homebrew; the catalog now only maps categories
- uncategorized formulas under "Other" are described too
- parse the JSON with jq when available (bundled with macOS 15+),
otherwise with JavaScript via osascript, which every macOS has —
both produce identical output
- the package list still comes from `brew list`: formulas from untrusted
taps or removed from Homebrew are missing from the JSON, they are
listed without a description instead of disappearing
- a failing `brew info` no longer hides any package
- tests: Homebrew descriptions, casks, uncategorized and missing
formulas, tab/newline handling, both JSON parsers (28 checks)
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.
Stacked on #2. Merge after it.
Why
brew info --json=v2 --installedreturns the official description of every installed package in one call (~0.5 s). The hand-writtenPKG_DESCcatalog duplicated that, and anything outside it had no description at all.Measured on a real machine (153 formulas, 10 casks):
Changes
jqwhen available (ships with macOS 15+), otherwise JavaScript viaosascript, which every macOS has. Both produce identical output on the real machine (verified withdiff).brew list. Homebrew leaves formulas from untrusted taps (e.g.mongodb/brew) and removed formulas out of the JSON. They stay listed and categorized, just without a description.brew descwas considered and rejected: it aborts entirely if a single package comes from an untrusted tap.brew infofails, every package is still shown.Tests (28 checks, was 17)
Homebrew descriptions for formulas and casks, uncategorized formulas, formulas missing from the JSON, tab/newline flattening, failing
brew info, and both parsers (BREWSHELF_JSON_PARSER=jq|osascript).