1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #6755 from tianon/bash-completion-for-link-and-bind

Update bash completion for "docker run --link" and "docker run -v" to complete on running containers and the local filesystem respectively
This commit is contained in:
Tianon Gravi 2014-07-15 00:15:13 -06:00
commit 47de2e3269

View file

@ -485,21 +485,52 @@ _docker_rmi()
_docker_run() _docker_run()
{ {
case "$prev" in case "$prev" in
--cidfile) -a|--attach)
COMPREPLY=( $( compgen -W 'stdin stdout stderr' -- "$cur" ) )
return
;;
--cidfile|--env-file)
_filedir _filedir
return
;; ;;
--volumes-from) --volumes-from)
__docker_containers_all __docker_containers_all
return
;; ;;
-v|--volume) -v|--volume)
# TODO something magical with colons and _filedir ? case "$cur" in
*:*)
# TODO somehow do _filedir for stuff inside the image, if it's already specified (which is also somewhat difficult to determine)
;;
'')
COMPREPLY=( $( compgen -W '/' -- "$cur" ) )
compopt -o nospace
;;
/*)
_filedir
compopt -o nospace
;;
esac
return return
;; ;;
-e|--env) -e|--env)
COMPREPLY=( $( compgen -e -- "$cur" ) ) COMPREPLY=( $( compgen -e -- "$cur" ) )
compopt -o nospace
return return
;; ;;
--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf) --link)
case "$cur" in
*:*)
;;
*)
__docker_containers_running
COMPREPLY=( $( compgen -W "${COMPREPLY[*]}" -S ':' ) )
compopt -o nospace
;;
esac
return
;;
--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf)
return return
;; ;;
*) *)