formatted gcloud completion and used helper function

pull/1782/head
Gurkirat Singh 2021-01-10 19:23:11 +05:30
parent 15461c4ca5
commit 6ccb6c8eef
No known key found for this signature in database
GPG Key ID: CFD64E1DCB3DA835
1 changed files with 9 additions and 5 deletions

View File

@ -1,9 +1,13 @@
#/usr/bin/env bash
# Bash completion for Google Cloud SDK
if which gcloud >/dev/null 2>&1; then
GOOGLE_SDK_ROOT=${GOOGLE_SDK_ROOT:-$(gcloud info --format="value(installation.sdk_root)")}
for i in $(ls ${GOOGLE_SDK_ROOT}/*.bash.inc); do
source $i
done
if _command_exists gcloud
then
# get install path
GOOGLE_SDK_ROOT=${GOOGLE_SDK_ROOT:-$(gcloud info --format="value(installation.sdk_root)")}
# souce all the bash completion file that are available
for i in $(ls ${GOOGLE_SDK_ROOT}/*.bash.inc); do
source $i
done
fi