summaryrefslogtreecommitdiff
path: root/plugins/gcloud
diff options
context:
space:
mode:
authorJames Yeoman <JamesYeoman@users.noreply.github.com>2022-04-26 11:37:42 +0100
committerMarc Cornellà <hello@mcornella.com>2022-09-08 20:33:23 +0200
commit18d2152798e15898f3c11a2fd3d8a59a62b4ac33 (patch)
tree46073cde22a480954fae2d60afe808dce0c0f51f /plugins/gcloud
parent875a4553204679cc1e3023a7d0e0bf2cf7d60800 (diff)
downloadzsh-18d2152798e15898f3c11a2fd3d8a59a62b4ac33.tar.gz
zsh-18d2152798e15898f3c11a2fd3d8a59a62b4ac33.tar.bz2
zsh-18d2152798e15898f3c11a2fd3d8a59a62b4ac33.zip
feat(gcloud): support for official apt repo (#10889)
Fixes #10888 Closes #10889
Diffstat (limited to 'plugins/gcloud')
-rw-r--r--plugins/gcloud/gcloud.plugin.zsh20
1 files changed, 17 insertions, 3 deletions
diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh
index 7368eb3a6..d43c62178 100644
--- a/plugins/gcloud/gcloud.plugin.zsh
+++ b/plugins/gcloud/gcloud.plugin.zsh
@@ -10,7 +10,8 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
"/usr/share/google-cloud-sdk"
"/snap/google-cloud-sdk/current"
- "/usr/lib64/google-cloud-sdk/"
+ "/usr/lib/google-cloud-sdk"
+ "/usr/lib64/google-cloud-sdk"
"/opt/google-cloud-sdk"
)
@@ -20,15 +21,28 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
break
fi
done
+ unset search_locations gcloud_sdk_location
fi
if (( ${+CLOUDSDK_HOME} )); then
+ # Only source this if gcloud isn't already on the path
if (( ! $+commands[gcloud] )); then
- # Only source this if GCloud isn't already on the path
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
source "${CLOUDSDK_HOME}/path.zsh.inc"
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
fi