Skip to content

Instantly share code, notes, and snippets.

@royingantaginting
Created July 27, 2016 07:15
Show Gist options
  • Save royingantaginting/187b8b00150cd1c6cdd7e71fa99d2af2 to your computer and use it in GitHub Desktop.
Save royingantaginting/187b8b00150cd1c6cdd7e71fa99d2af2 to your computer and use it in GitHub Desktop.
_docker_ip()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(docker ps --format "{{ .Names }}")
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _docker_ip docker-ip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment