brew/Library/Homebrew/cmd/formulae.sh

29 lines
717 B
Bash
Raw Normal View History

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
#:
homebrew-formulae() {
local formulae
2020-11-20 12:43:38 +00:00
formulae="$( \
find "$HOMEBREW_REPOSITORY/Library/Taps" \
-type d \( \
-name Casks -o \
-name cmd -o \
-name .github -o \
-name lib -o \
-name spec -o \
-name vendor \
\) \
-prune -false -o -name '*\.rb' | \
sed -r -e 's/\.rb//g' \
2020-11-20 12:43:38 +00:00
-e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
-e 's|/Formula/|/|' \
)"
local shortnames
2020-11-20 12:43:38 +00:00
shortnames="$(echo "$formulae" | cut -d "/" -f 3)"
2020-12-01 12:59:32 -06:00
echo -e "$formulae\n$shortnames" | \
2020-11-20 12:43:38 +00:00
grep -v '^homebrew/core' | \
sort -uf
2020-11-19 20:27:19 -07:00
}