Check for bashcompinit availability before loading it; unset variables.

This commit is contained in:
Sorin Ionescu 2011-07-17 20:28:50 -04:00
parent c17c459968
commit af04d57948

View file

@ -1,20 +1,20 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# FILE: compleat.plugin.zsh # FILE: compleat.plugin.zsh
# DESCRIPTION: oh-my-zsh plugin file. # DESCRIPTION: oh-my-zsh plugin file.
# AUTHOR: Sorin Ionescu (sorin.ionescu@gmail.com) # AUTHOR: Sorin Ionescu <sorin.ionescu@gmail.com>
# VERSION: 1.0.0 # VERSION: 1.0.1
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if (( ${+commands[compleat]} )); then if (( ${+commands[compleat]} )); then
local prefix="${commands[compleat]:h:h}" compleat_setup="${commands[compleat]:h:h}/share/compleat-1.0/compleat_setup"
local setup="${prefix}/share/compleat-1.0/compleat_setup"
if [[ -f "$setup" ]]; then if [[ -f "$compleat_setup" ]]; then
if ! bashcompinit >/dev/null 2>&1; then if ! bashcompinit >/dev/null 2>&1; then
autoload -U bashcompinit autoload -Uz bashcompinit && bashcompinit
bashcompinit -i
fi fi
source "$setup" source "$compleat_setup"
unset compleat_setup
fi fi
fi fi