WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@InspiratioNULL
Copy link

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

Changes

  • Add a --desc flag to brew list to print descriptions for the selected formulae and/or casks.
  • Extend brew list --json=v2 so each formula and cask entry includes a desc field.
  • Refactor the output_json_v2 formula selection logic to remove a duplicated branch.
  • Update Sorbet RBI so Homebrew::Cmd::List::Args exposes desc?.

Motivation

I'm working on a multi package manager project, and noticed certain data was straightforward to obtain via the following commands:

  • pkgsrc: pkgin avail || pkgin list
  • MacPorts: port info --name --description all

Previously, the closest option was brew info --eval-all --json=v2, which includes a lot of
extra data. The new brew list behavior gives:

  • Human-readable descriptions:

    brew list --eval-all --desc
    brew list --eval-all --formula --desc
    brew list --eval-all --cask --desc
    brew list --desc
    

(--eval-all = all packages whether installed or not)

I think it is a useful addition to Homebrew, can be used to pipe into other commands in useful ways. After my initial introduction to the macOS platform a couple years ago, and Homebrew as well. I've an avid Homebrew user ever since and I am pleased to contribute to Homebrew!

Note:

Testing

==> brew typecheck
No errors! Great job.

==> brew style --changed --fix
Inspecting 33 files
.................................

33 files inspected, no offenses detected

==> brew tests --changed
  - Note: `evaluates all casks with --eval-all --json=v2` timed out locally (`Timeout::ExitException`),
    other `cmd/list` examples passed.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 107 to 111
case json_version(T.unsafe(args).json)
when :v2
output_json_v2
else
legacy_list

Choose a reason for hiding this comment

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

P1 Badge Honor list --json default and v1 outputs

The new run case only emits JSON when json_version returns :v2; --json (which maps to :default) and --json=v1 now fall through to legacy_list and print the normal text listing. The CLI description still promises JSON output with v1 as the default, so brew list --json/--json=v1 will no longer return JSON at all.

Useful? React with 👍 / 👎.

Comment on lines 349 to 350
elsif T.unsafe(args).cask?
args.no_named? ? Cask::Cask.all(eval_all: true) : args.named.to_casks

Choose a reason for hiding this comment

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

P1 Badge --desc --cask dumps all casks instead of installed set

In list_descriptions, the --cask branch always loads Cask::Cask.all(eval_all: true) when no names are provided, even without --eval-all. That means brew list --cask --desc now scans and prints descriptions for every available cask rather than the installed casks that brew list --cask would normally show, producing incorrect and extremely large output.

Useful? React with 👍 / 👎.

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.

1 participant