Merge pull request #14543 from MikeMcQuaid/info-json-api

cmd/info: generate `--json=v2` from local taps.
This commit is contained in:
Mike McQuaid 2023-02-07 15:32:49 +01:00 committed by GitHub
commit 206d4c86b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,6 +222,14 @@ module Homebrew
formulae.map(&:to_hash)
end
when :v2
# Cannot generate cask API JSON data from the cask JSON API
if EnvConfig.install_from_api?
ENV["HOMEBREW_NO_INSTALL_FROM_API"] = "1"
core_untapped = !CoreTap.instance.installed?
cask_untapped = !Tap.fetch("Homebrew/homebrew-cask").installed?
raise UsageError, "tap homebrew/core and/or homebrew/cask to use --json=v2" if core_untapped || cask_untapped
end
formulae, casks = if all
[Formula.all.sort, Cask::Cask.all.sort_by(&:full_name)]
elsif args.installed?