1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-29 09:10:07 +00:00

feat(gcloud): support for official apt repo (#10889)

Fixes #10888
Closes #10889
This commit is contained in:
James Yeoman 2022-04-26 11:37:42 +01:00 committed by Marc Cornellà
parent 875a455320
commit 18d2152798
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B

View file

@ -10,7 +10,8 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk" "/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/usr/share/google-cloud-sdk" "/usr/share/google-cloud-sdk"
"/snap/google-cloud-sdk/current" "/snap/google-cloud-sdk/current"
"/usr/lib64/google-cloud-sdk/" "/usr/lib/google-cloud-sdk"
"/usr/lib64/google-cloud-sdk"
"/opt/google-cloud-sdk" "/opt/google-cloud-sdk"
) )
@ -20,15 +21,28 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
break break
fi fi
done done
unset search_locations gcloud_sdk_location
fi fi
if (( ${+CLOUDSDK_HOME} )); then if (( ${+CLOUDSDK_HOME} )); then
# Only source this if gcloud isn't already on the path
if (( ! $+commands[gcloud] )); then if (( ! $+commands[gcloud] )); then
# Only source this if GCloud isn't already on the path
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
source "${CLOUDSDK_HOME}/path.zsh.inc" source "${CLOUDSDK_HOME}/path.zsh.inc"
fi fi
fi fi
source "${CLOUDSDK_HOME}/completion.zsh.inc"
# Look for completion file in different paths
for comp_file (
"${CLOUDSDK_HOME}/completion.zsh.inc" # default location
"/usr/share/google-cloud-sdk/completion.zsh.inc" # apt-based location
); do
if [[ -f "${comp_file}" ]]; then
source "${comp_file}"
break
fi
done
unset comp_file
export CLOUDSDK_HOME export CLOUDSDK_HOME
fi fi