2019-09-20 13:58:35 +02:00
|
|
|
#####################################################
|
|
|
|
# gcloud plugin for oh-my-zsh #
|
|
|
|
# Author: Ian Chesal (github.com/ianchesal) #
|
|
|
|
#####################################################
|
|
|
|
|
|
|
|
if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
|
|
|
search_locations=(
|
|
|
|
"$HOME/google-cloud-sdk"
|
2023-06-26 10:35:38 +02:00
|
|
|
"/usr/local/share/google-cloud-sdk"
|
2019-09-20 13:58:35 +02:00
|
|
|
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
2021-09-06 11:28:32 +02:00
|
|
|
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
2024-03-30 08:26:14 +01:00
|
|
|
"/opt/homebrew/share/google-cloud-sdk"
|
2019-09-20 13:58:35 +02:00
|
|
|
"/usr/share/google-cloud-sdk"
|
|
|
|
"/snap/google-cloud-sdk/current"
|
2023-02-17 08:09:00 +01:00
|
|
|
"/snap/google-cloud-cli/current"
|
2022-04-26 12:37:42 +02:00
|
|
|
"/usr/lib/google-cloud-sdk"
|
|
|
|
"/usr/lib64/google-cloud-sdk"
|
2019-09-21 23:11:25 +02:00
|
|
|
"/opt/google-cloud-sdk"
|
2023-05-31 23:59:41 +02:00
|
|
|
"/opt/google-cloud-cli"
|
2022-08-26 04:02:35 +02:00
|
|
|
"/opt/local/libexec/google-cloud-sdk"
|
2024-01-05 10:38:26 +01:00
|
|
|
"$HOME/.asdf/installs/gcloud/*/"
|
2019-09-20 13:58:35 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
for gcloud_sdk_location in $search_locations; do
|
|
|
|
if [[ -d "${gcloud_sdk_location}" ]]; then
|
|
|
|
CLOUDSDK_HOME="${gcloud_sdk_location}"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2022-04-26 12:37:42 +02:00
|
|
|
unset search_locations gcloud_sdk_location
|
2019-09-20 13:58:35 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if (( ${+CLOUDSDK_HOME} )); then
|
2023-09-20 12:09:46 +02:00
|
|
|
# Source path file
|
|
|
|
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
|
|
|
|
source "${CLOUDSDK_HOME}/path.zsh.inc"
|
2019-09-20 13:58:35 +02:00
|
|
|
fi
|
2022-04-26 12:37:42 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2019-09-20 13:58:35 +02:00
|
|
|
export CLOUDSDK_HOME
|
|
|
|
fi
|