mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
30 lines
668 B
Bash
30 lines
668 B
Bash
![]() |
#: * `casks`
|
||
|
#:
|
||
|
#: List all locally installable casks including short names.
|
||
|
#:
|
||
|
|
||
|
homebrew-casks() {
|
||
|
local casks
|
||
|
local sed_extended_regex_flag
|
||
|
|
||
|
if [[ -n "$HOMEBREW_MACOS" ]]; then
|
||
|
sed_extended_regex_flag="-E"
|
||
|
else
|
||
|
sed_extended_regex_flag="-r"
|
||
|
fi
|
||
|
|
||
|
casks="$( \
|
||
|
find "$HOMEBREW_REPOSITORY/Library/Taps" \
|
||
|
-maxdepth 4 -path '*/Casks/*.rb' | \
|
||
|
sed "$sed_extended_regex_flag" \
|
||
|
-e 's/\.rb//g' \
|
||
|
-e 's_.*/Taps/(.*)/(home|linux)brew-_\1/_' \
|
||
|
-e 's|/Casks/|/|' \
|
||
|
)"
|
||
|
local shortnames
|
||
|
shortnames="$(echo "$casks" | cut -d "/" -f 3)"
|
||
|
echo -e "$casks\n$shortnames" | \
|
||
|
grep -v '^homebrew/cask' | \
|
||
|
sort -uf
|
||
|
}
|