-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: link all brew kegs via brew.link-all-keg
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
- Loading branch information
1 parent
1b588a7
commit ba489c2
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#autoload | ||
|
||
emulate -L zsh | ||
zmodload zsh/zutil || return | ||
|
||
local flag_help flag_verbose | ||
local -a arg_extension=() | ||
|
||
local -a usage=( | ||
"brew.link-kegs [-h|--help]" | ||
) | ||
|
||
zmodload zsh/zutil | ||
zparseopts -D -F -K -- {h,-help}=flag_help || return 1 | ||
|
||
[[ -z "$flag_help" ]] || { print -l $usage && return } | ||
|
||
local -a brew_keg_only=( | ||
$( | ||
brew info --installed --json=v1 \ | ||
| jq --raw-output --compact-output 'map(select(.keg_only == true)) | map(.name) | @sh' | ||
) | ||
) | ||
|
||
for keg in $brew_keg_only; do | ||
export PATH="${HOMEBREW_PREFIX}/opt/${(Q)keg}/bin:${PATH}" | ||
print -P -- "%F{green}==>%f ${keg} added to PATH" | ||
done | ||
|
||
# vim: set expandtab filetype=zsh shiftwidth=2 softtabstop=2 tabstop=2: |