From 1d3be0eae9858f7bf0b0e9c14254df1166a5ff3c Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Mon, 29 Dec 2014 19:21:45 +0100 Subject: [PATCH] Add missing options to bash completion Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 51 ++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 7fcbfca548..cf253e9cee 100755 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -368,7 +368,18 @@ _docker_kill() { } _docker_load() { - return + case "$prev" in + -i|--input) + _filedir + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-i --input" -- "$cur" ) ) + ;; + esac } _docker_login() { @@ -516,9 +527,11 @@ _docker_run() { --env-file --expose -h --hostname + --ipc --link --lxc-conf -m --memory + --mac-address --name --net -p --publish @@ -577,6 +590,21 @@ _docker_run() { compopt -o nospace return ;; + --ipc) + case "$cur" in + *:*) + cur="${cur#*:}" + __docker_containers_running + ;; + *) + COMPREPLY=( $( compgen -W 'host container:' -- "$cur" ) ) + if [ "$COMPREPLY" = "container:" ]; then + compopt -o nospace + fi + ;; + esac + return + ;; --link) case "$cur" in *:*) @@ -644,7 +672,7 @@ _docker_run() { esac return ;; - --entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf|--dns-search) + --entrypoint|-h|--hostname|--mac-address|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf|--dns-search) return ;; esac @@ -664,10 +692,21 @@ _docker_run() { } _docker_save() { - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_image_repos_and_tags_and_ids - fi + case "$prev" in + -o|--output) + _filedir + return + ;; + esac + + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "-o --output" -- "$cur" ) ) + ;; + *) + __docker_image_repos_and_tags_and_ids + ;; + esac } _docker_search() {