Skip to content

Instantly share code, notes, and snippets.

@tomplex
Created December 2, 2017 01:42
Show Gist options
  • Save tomplex/1a71d50104931a4ad4f15b58f4722894 to your computer and use it in GitHub Desktop.
Save tomplex/1a71d50104931a4ad4f15b58f4722894 to your computer and use it in GitHub Desktop.
Stop & remove Docker container with completions
#! /usr/bin/env bash
container_stop_rm () {
docker rm $(docker stop $1)
}
_container_stop_rm () {
containers=$(docker ps --format '{{ .Names }}')
COMPREPLY=( $(compgen -W "$containers" -- "${COMP_WORDS[COMP_CWORD]}" ) )
}
complete -F _container_stop_rm container_stop_rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment