Minor bash completion cleanup

The -n and --networking options were removed because they are
unsupported. 
Bash completion should not reveal the existence of otherwise
undocumented unsupported options.

Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
Harald Albers 2014-11-19 14:29:56 +01:00 committed by Tibor Vass
parent 055b224c90
commit 3addb4d642
1 changed files with 8 additions and 44 deletions

View File

@ -1,8 +1,8 @@
#!bash #!/bin/bash
# #
# bash completion file for core docker commands # bash completion file for core docker commands
# #
# This script provides supports completion of: # This script provides completion of:
# - commands and their options # - commands and their options
# - container ids and names # - container ids and names
# - image repos and tags # - image repos and tags
@ -11,9 +11,9 @@
# To enable the completions either: # To enable the completions either:
# - place this file in /etc/bash_completion.d # - place this file in /etc/bash_completion.d
# or # or
# - copy this file and add the line below to your .bashrc after # - copy this file to e.g. ~/.docker-completion.sh and add the line
# bash completion features are loaded # below to your .bashrc after bash completion features are loaded
# . docker.bash # . ~/.docker-completion.sh
# #
# Note: # Note:
# Currently, the completions will not work if the docker daemon is not # Currently, the completions will not work if the docker daemon is not
@ -153,8 +153,6 @@ _docker_docker() {
-H) -H)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
@ -187,8 +185,6 @@ _docker_build() {
__docker_image_repos_and_tags __docker_image_repos_and_tags
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
@ -209,8 +205,6 @@ _docker_commit() {
-m|--message|-a|--author|--run) -m|--message|-a|--author|--run)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
@ -362,13 +356,11 @@ _docker_create() {
--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|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf|--dns-search)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "-n --networking --privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir --cpuset -c --cpu-shares --name -a --attach -v --volume --link -e --env --env-file -p --publish --expose --dns --volumes-from --lxc-conf --security-opt --add-host --cap-add --cap-drop --device --dns-search --net --restart" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir --cpuset -c --cpu-shares --name -a --attach -v --volume --link -e --env --env-file -p --publish --expose --dns --volumes-from --lxc-conf --security-opt --add-host --cap-add --cap-drop --device --dns-search --net --restart" -- "$cur" ) )
;; ;;
*) *)
local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--env-file|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf|--security-opt|--add-host|--cap-add|--cap-drop|--device|--dns-search|--net|--restart') local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--env-file|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf|--security-opt|--add-host|--cap-add|--cap-drop|--device|--dns-search|--net|--restart')
@ -392,16 +384,12 @@ _docker_events() {
--since) --since)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--since" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--since" -- "$cur" ) )
;; ;;
*)
;;
esac esac
} }
@ -480,8 +468,6 @@ _docker_inspect() {
-f|--format) -f|--format)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
@ -507,16 +493,12 @@ _docker_login() {
-u|--username|-p|--password|-e|--email) -u|--username|-p|--password|-e|--email)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "-u --username -p --password -e --email" -- "$cur" ) ) COMPREPLY=( $( compgen -W "-u --username -p --password -e --email" -- "$cur" ) )
;; ;;
*)
;;
esac esac
} }
@ -556,16 +538,12 @@ _docker_ps() {
-n) -n)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "-q --quiet -s --size -a --all --no-trunc -l --latest --since --before -n" -- "$cur" ) ) COMPREPLY=( $( compgen -W "-q --quiet -s --size -a --all --no-trunc -l --latest --since --before -n" -- "$cur" ) )
;; ;;
*)
;;
esac esac
} }
@ -574,8 +552,6 @@ _docker_pull() {
-t|--tag) -t|--tag)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
@ -603,8 +579,6 @@ _docker_restart() {
-t|--time) -t|--time)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
@ -624,7 +598,6 @@ _docker_rm() {
return return
;; ;;
*) *)
local force=
for arg in "${COMP_WORDS[@]}"; do for arg in "${COMP_WORDS[@]}"; do
case "$arg" in case "$arg" in
-f|--force) -f|--force)
@ -748,16 +721,13 @@ _docker_run() {
--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|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-p|--publish|--expose|--dns|--lxc-conf|--dns-search)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--rm -d --detach -n --networking --privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir --cpuset -c --cpu-shares --sig-proxy --name -a --attach -v --volume --link -e --env --env-file -p --publish --expose --dns --volumes-from --lxc-conf --security-opt --add-host --cap-add --cap-drop --device --dns-search --net --restart" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--rm -d --detach --privileged -P --publish-all -i --interactive -t --tty --cidfile --entrypoint -h --hostname -m --memory -u --user -w --workdir --cpuset -c --cpu-shares --sig-proxy --name -a --attach -v --volume --link -e --env --env-file -p --publish --expose --dns --volumes-from --lxc-conf --security-opt --add-host --cap-add --cap-drop --device --dns-search --net --restart" -- "$cur" ) )
;; ;;
*) *)
local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--env-file|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf|--security-opt|--add-host|--cap-add|--cap-drop|--device|--dns-search|--net|--restart') local counter=$(__docker_pos_first_nonflag '--cidfile|--volumes-from|-v|--volume|-e|--env|--env-file|--entrypoint|-h|--hostname|-m|--memory|-u|--user|-w|--workdir|--cpuset|-c|--cpu-shares|-n|--name|-a|--attach|--link|-p|--publish|--expose|--dns|--lxc-conf|--security-opt|--add-host|--cap-add|--cap-drop|--device|--dns-search|--net|--restart')
if [ $cword -eq $counter ]; then if [ $cword -eq $counter ]; then
@ -779,16 +749,12 @@ _docker_search() {
-s|--stars) -s|--stars)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--no-trunc --automated -s --stars" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--no-trunc --automated -s --stars" -- "$cur" ) )
;; ;;
*)
;;
esac esac
} }
@ -808,8 +774,6 @@ _docker_stop() {
-t|--time) -t|--time)
return return
;; ;;
*)
;;
esac esac
case "$cur" in case "$cur" in
@ -911,7 +875,7 @@ _docker() {
local cur prev words cword local cur prev words cword
_get_comp_words_by_ref -n : cur prev words cword _get_comp_words_by_ref -n : cur prev words cword
local command='docker' local command='docker' cpos=0
local counter=1 local counter=1
while [ $counter -lt $cword ]; do while [ $counter -lt $cword ]; do
case "${words[$counter]}" in case "${words[$counter]}" in