brew/Library/Homebrew/cmd/formulae.sh

14 lines
515 B
Bash
Raw Normal View History

2020-11-19 20:18:08 -07:00
#: * `formulae` [<options>]
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-19 20:43:09 -07:00
formulae="$(find "$HOMEBREW_REPOSITORY"/Library/Taps -type d \( -name Casks -o -name cmd -o -name .github \) -prune -false -o -name '*rb' |\
sed -E -e 's/\.rb//g' -e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' -e 's|/Formula/|/|')"
local shortnames
2020-11-19 20:43:09 -07:00
shortnames="$(echo "$formulae" | cut -d / -f 3)"
echo -e "$formulae \n $shortnames" | grep -v '^homebrew/' | sort -uf
2020-11-19 20:27:19 -07:00
}