-
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.
fix: set brew prefix in +brew-link-keg
Signed-off-by: vladislav doster <10052309+vladdoster@users.noreply.github.com>
- Loading branch information
1 parent
cfee6be
commit 2d80caf
Showing
1 changed file
with
11 additions
and
9 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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
#autoload | ||
|
||
emulate -L zsh | ||
setopt extended_glob | ||
|
||
zmodload zsh/zutil || return 1 | ||
|
||
opt_help= | ||
cli_usage=("Usage: +brew-link-kegs [-h|--help]") | ||
opt_help= | ||
cli_usage=("Usage: +brew-link-kegs [-h|--help]") | ||
|
||
zparseopts -D -F -K -- {h,-help}=opt_help || return 1 | ||
|
||
builtin print -- $opt_help | ||
[[ -z "$opt_help" ]] || { builtin print -l $cli_usage && return } | ||
|
||
brew_keg_only=( $(brew info --installed --json=v1 | jq --raw-output --compact-output 'map(select(.keg_only == true)) | map(.name) | @sh') ) | ||
[[ -z "$opt_help" ]] || { | ||
builtin print -l $cli_usage && return | ||
} | ||
|
||
brew_keg_only=($(brew info --installed --json=v1 | jq --raw-output --compact-output 'map(select(.keg_only == true)) | map(.name) | @sh')) | ||
local HOMEBREW_PREFIX="$(brew --prefix)" | ||
for keg in ${(@on)brew_keg_only}; do | ||
PATH="${HOMEBREW_PREFIX}/opt/${(Q)keg}/bin:${PATH}" | ||
PATH="${HOMEBREW_PREFIX}/opt/${(Q)keg}/bin:${PATH}" | ||
builtin print -P -- "%F{green}==>%f [+] ${(Q)keg}" | ||
done | ||
typeset -Ugx PATH | ||
|
||
|
||
# vim: set expandtab filetype=zsh shiftwidth=2 softtabstop=2 tabstop=2: | ||
# vim: set expandtab filetype=zsh shiftwidth=4 softtabstop=4 tabstop=4: |