completion: Add completion for keg-only brewed curl when available

As curl bundled with macOS does not include `_curl` definitions, one
way to make `_curl` available is to install curl from Homebrew.

However, since curl from Hombrew is _keg-only_, its function path needs
to be explicitly included.
This commit is contained in:
Indrajit Raychaudhuri 2021-05-02 01:50:30 -05:00 committed by Indrajit Raychaudhuri
parent 509c5ca80f
commit e87a9b0a93
1 changed files with 7 additions and 0 deletions

View File

@ -14,6 +14,13 @@ fi
# Add zsh-completions to $fpath.
fpath=("${0:h}/external/src" $fpath)
# Add completion for keg-only brewed curl when available.
if (( $+commands[brew] && ! $+functions[_curl] )) && \
[[ -d "${curl_prefix::="$(brew --prefix curl 2> /dev/null)"}" ]]; then
fpath=("${curl_prefix}/share/zsh/site-functions" $fpath)
unset curl_prefix
fi
#
# Options
#