brew/Library/Homebrew/cmd/formulae.sh
2020-11-19 20:18:08 -07:00

11 lines
534 B
Bash

#: * `formulae` [<options>]
#:
#: Prints a sorted list of locally available formulas including shortnames.
#:
# shellcheck disable=SC2155
homebrew-formulae() {
local 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="$(echo "$formulae" | \cut -d / -f 3)"
echo -e "$formulae \n $shortnames" | \grep -v '^homebrew/' | \sort -uf
}