Skip to content

Commit 597cda1

Browse files
andrewrembrandtmarc0der
authored andcommitted
Prevent Re-initialization of zsh completion system
* Resolves issue with gcloud sdk completions not working
1 parent 4b4822d commit 597cda1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/bash/sdkman-init.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,11 @@ export PATH
178178
# source completion scripts
179179
if [[ "$sdkman_auto_complete" == 'true' ]]; then
180180
if [[ "$zsh_shell" == 'true' ]]; then
181-
autoload -Uz compinit
182-
compinit
181+
# initialize zsh completions (if not already done)
182+
if ! (( $+functions[compdef] )) ; then
183+
autoload -Uz compinit
184+
compinit
185+
fi
183186
source "${SDKMAN_DIR}/contrib/completion/zsh/sdk"
184187
__sdkman_echo_debug "ZSH completion script loaded..."
185188
elif [[ "$bash_shell" == 'true' ]]; then

0 commit comments

Comments
 (0)