.bash_completion.d/gssh
author Oleksandr Gavenko <gavenkoa@gmail.com>
Wed, 29 Mar 2023 23:42:06 +0300
changeset 1018 831e2c1bf980
parent 935 79dd24c983f5
permissions -rw-r--r--
Completed migration from ~/devel to ~/work.

alias gssh='gcloud compute ssh --tunnel-through-iap'

_gssh() {
  local cur=${COMP_WORDS[COMP_CWORD]}
  [[ "$cur" = -* ]] && return 0
  local hosts=$(gcloud compute instances list --format='value(name)')
  COMPREPLY=( $(compgen -W "$hosts" -- "$cur") )
  return 0
}

complete -F _gssh gssh