formatted gcloud completion and used helper function

pull/1803/head
Gurkirat Singh 2021-01-10 19:23:11 +05:30 committed by Noah Gorny
parent 8dfc4cee20
commit ba5700e555
2 changed files with 11 additions and 6 deletions

View File

@ -63,6 +63,7 @@ completion/available/cargo.completion.bash
completion/available/conda.completion.bash
completion/available/consul.completion.bash
completion/available/docker.completion.bash
completion/available/gcloud.completion.bash
completion/available/knife.completion.bash
completion/available/packer.completion.bash
completion/available/pipx.completion.bash

View File

@ -1,9 +1,13 @@
#/usr/bin/env bash
# shellcheck shell=bash
# Bash completion for Google Cloud SDK
if which gcloud >/dev/null 2>&1; then
if _command_exists gcloud; then
# get install path
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
# source all the bash completion file that are available
for i in "${GOOGLE_SDK_ROOT}"/*.bash.inc; do
# shellcheck disable=SC1090
source "$i"
done
fi