Created
October 2, 2020 10:20
-
-
Save briandeheus/f52bc9aad9973260f1df2ad6d3d15a42 to your computer and use it in GitHub Desktop.
gcp-autocomplete.plugin.zsh
This file contains hidden or 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
_get_gcp_accounts() { | |
res=$(gcloud auth list --format="value(account)") | |
for i in $res; do | |
COMPREPLY+=("$i") | |
done | |
} | |
_get_gcp_projects() { | |
res=$(gcloud projects list --format="value(projectId)") | |
for i in $res; do | |
COMPREPLY+=("$i") | |
done | |
} | |
googlesu() { | |
gcloud config set account "$1" | |
} | |
googlesp() { | |
gcloud config set project "$1" | |
} | |
complete -o default -F _get_gcp_accounts googlesu | |
complete -o default -F _get_gcp_projects googlesp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment