Skip to content

Instantly share code, notes, and snippets.

@briandeheus
Created October 2, 2020 10:20
Show Gist options
  • Save briandeheus/f52bc9aad9973260f1df2ad6d3d15a42 to your computer and use it in GitHub Desktop.
Save briandeheus/f52bc9aad9973260f1df2ad6d3d15a42 to your computer and use it in GitHub Desktop.
gcp-autocomplete.plugin.zsh
_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