20 lines
658 B
Bash
Executable File
20 lines
658 B
Bash
Executable File
#!/usr/bin/env zsh
|
|
|
|
# Check if third party completions are present.
|
|
local zsh_completions=~/.config/zsh/zsh-completions
|
|
[ ! -d $zsh_completions ] && return 0
|
|
|
|
# Loop over all completions.
|
|
for completion in $zsh_completions/src/_*; do
|
|
local name=`basename $completion`
|
|
local symlink=~/.local/share/zsh/site-functions/$name
|
|
# Remove existing completion file if it exists.
|
|
[ -f $symlink ] && rm $symlink
|
|
# Check if the command exists on the PATH.
|
|
if command -v ${name:1} &> /dev/null; then
|
|
# Symlink the completion for the existing command.
|
|
[ `uname` = Darwin ] && \
|
|
ln -s $completion $symlink || ln -sr $completion $symlink
|
|
fi
|
|
done
|