diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2022-11-05 14:55:11 -0700 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2022-11-05 14:55:11 -0700 |
commit | 04b8c052e5b624873b352889423c753ed1baf9c4 (patch) | |
tree | 78e14fe69e61d69709f31f91b7ae29fe8bc74477 /plugins/gcloud | |
parent | 1a6dcd017dbf564058a729032de3db139fcf9c7e (diff) | |
parent | 80fdbc9b91a9acca42fb90065b5e64a9722978a7 (diff) | |
download | zsh-04b8c052e5b624873b352889423c753ed1baf9c4.tar.gz zsh-04b8c052e5b624873b352889423c753ed1baf9c4.tar.bz2 zsh-04b8c052e5b624873b352889423c753ed1baf9c4.zip |
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'plugins/gcloud')
-rw-r--r-- | plugins/gcloud/gcloud.plugin.zsh | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/plugins/gcloud/gcloud.plugin.zsh b/plugins/gcloud/gcloud.plugin.zsh index 7368eb3a6..9be9d68aa 100644 --- a/plugins/gcloud/gcloud.plugin.zsh +++ b/plugins/gcloud/gcloud.plugin.zsh @@ -10,8 +10,10 @@ 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" + "/opt/local/libexec/google-cloud-sdk" ) for gcloud_sdk_location in $search_locations; do @@ -20,15 +22,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 |