-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use asdf exec-env to set CLOUDSDK_PYTHON on each gcloud cmd… (#14)
* feat: use asdf exec-env to set CLOUDSDK_PYTHON on each gcloud cmd use * feat: enforce bash strict mode * fix: unset var with bash strict mode
- Loading branch information
Showing
3 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
if [[ ! -x "$(command -v python)" ]]; then | ||
printf "🚨 Python not found and is required for gcloud. Might I suggest https://github.com/danhper/asdf-python\\n" | ||
exit 1 | ||
fi | ||
|
||
# stolen from https://unix.stackexchange.com/a/56846/397902 | ||
if [ -z "${CLOUDSDK_PYTHON:+1}" ]; then | ||
# undefined or defined and empty | ||
python_sdk="$(command -v python)" | ||
export CLOUDSDK_PYTHON=${python_sdk} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters