2020-11-19 20:50:34 -07:00
|
|
|
#: * `formulae`
|
2020-11-19 20:27:19 -07:00
|
|
|
#:
|
|
|
|
#: List all locally installable formulae including short names.
|
2020-10-24 18:34:03 -06:00
|
|
|
#:
|
|
|
|
|
2021-05-18 17:10:20 +05:30
|
|
|
# HOMEBREW_LIBRARY is set by bin/brew
|
|
|
|
# shellcheck disable=SC2154
|
|
|
|
source "${HOMEBREW_LIBRARY}/Homebrew/items.sh"
|
2020-12-02 17:40:10 +00:00
|
|
|
|
2021-01-08 18:04:51 +08:00
|
|
|
homebrew-formulae() {
|
2022-12-19 16:30:49 -08:00
|
|
|
local formulae
|
|
|
|
formulae="$(homebrew-items '*\.rb' 'Casks' 's|/Formula/|/|' '^homebrew/core')"
|
|
|
|
|
|
|
|
# HOMEBREW_CACHE is set by brew.sh
|
|
|
|
# shellcheck disable=SC2154
|
2023-01-18 15:50:13 +00:00
|
|
|
if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" &&
|
|
|
|
-f "${HOMEBREW_CACHE}/api/formula.json" ]]
|
2022-12-19 16:30:49 -08:00
|
|
|
then
|
|
|
|
local api_formulae
|
|
|
|
api_formulae="$(ruby -e "require 'json'; JSON.parse(File.read('${HOMEBREW_CACHE}/api/formula.json')).each { |f| puts f['name'] }" 2>/dev/null)"
|
|
|
|
formulae="$(echo -e "${formulae}\n${api_formulae}" | sort -uf | grep .)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "${formulae}"
|
2020-11-19 20:27:19 -07:00
|
|
|
}
|