|
|
@ -41,17 +41,7 @@ help_usage "$@"
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
project_id="$1"
|
|
|
|
project_id="$1"
|
|
|
|
shift || :
|
|
|
|
shift || :
|
|
|
|
current_project="$(gcloud config list --format="value(core.project)")"
|
|
|
|
export CLOUDSDK_CORE_PROJECT="$project_id"
|
|
|
|
if [ -n "$current_project" ]; then
|
|
|
|
|
|
|
|
# want interpolation now not at exit
|
|
|
|
|
|
|
|
# shellcheck disable=SC2064
|
|
|
|
|
|
|
|
trap "gcloud config set project '$current_project'" EXIT
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
trap "gcloud config unset project" EXIT
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
gcloud config set project "$project_id"
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|