Move bash completion logic to new subcommand: build
Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
parent
33910a89b9
commit
db31883a92
1 changed files with 66 additions and 66 deletions
|
@ -825,71 +825,7 @@ _docker_attach() {
|
|||
}
|
||||
|
||||
_docker_build() {
|
||||
local options_with_args="
|
||||
--build-arg
|
||||
--cgroup-parent
|
||||
--cpuset-cpus
|
||||
--cpuset-mems
|
||||
--cpu-shares -c
|
||||
--cpu-period
|
||||
--cpu-quota
|
||||
--file -f
|
||||
--isolation
|
||||
--label
|
||||
--memory -m
|
||||
--memory-swap
|
||||
--shm-size
|
||||
--tag -t
|
||||
--ulimit
|
||||
"
|
||||
|
||||
local boolean_options="
|
||||
--compress
|
||||
--disable-content-trust=false
|
||||
--force-rm
|
||||
--help
|
||||
--no-cache
|
||||
--pull
|
||||
--quiet -q
|
||||
--rm
|
||||
"
|
||||
|
||||
local all_options="$options_with_args $boolean_options"
|
||||
|
||||
case "$prev" in
|
||||
--build-arg)
|
||||
COMPREPLY=( $( compgen -e -- "$cur" ) )
|
||||
__docker_nospace
|
||||
return
|
||||
;;
|
||||
--file|-f)
|
||||
_filedir
|
||||
return
|
||||
;;
|
||||
--isolation)
|
||||
__docker_complete_isolation
|
||||
return
|
||||
;;
|
||||
--tag|-t)
|
||||
__docker_complete_image_repos_and_tags
|
||||
return
|
||||
;;
|
||||
$(__docker_to_extglob "$options_with_args") )
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$cur" in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
|
||||
if [ $cword -eq $counter ]; then
|
||||
_filedir -d
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
_docker_image_build
|
||||
}
|
||||
|
||||
|
||||
|
@ -2063,7 +1999,71 @@ _docker_image() {
|
|||
}
|
||||
|
||||
_docker_image_build() {
|
||||
_docker_build
|
||||
local options_with_args="
|
||||
--build-arg
|
||||
--cgroup-parent
|
||||
--cpuset-cpus
|
||||
--cpuset-mems
|
||||
--cpu-shares -c
|
||||
--cpu-period
|
||||
--cpu-quota
|
||||
--file -f
|
||||
--isolation
|
||||
--label
|
||||
--memory -m
|
||||
--memory-swap
|
||||
--shm-size
|
||||
--tag -t
|
||||
--ulimit
|
||||
"
|
||||
|
||||
local boolean_options="
|
||||
--compress
|
||||
--disable-content-trust=false
|
||||
--force-rm
|
||||
--help
|
||||
--no-cache
|
||||
--pull
|
||||
--quiet -q
|
||||
--rm
|
||||
"
|
||||
|
||||
local all_options="$options_with_args $boolean_options"
|
||||
|
||||
case "$prev" in
|
||||
--build-arg)
|
||||
COMPREPLY=( $( compgen -e -- "$cur" ) )
|
||||
__docker_nospace
|
||||
return
|
||||
;;
|
||||
--file|-f)
|
||||
_filedir
|
||||
return
|
||||
;;
|
||||
--isolation)
|
||||
__docker_complete_isolation
|
||||
return
|
||||
;;
|
||||
--tag|-t)
|
||||
__docker_complete_image_repos_and_tags
|
||||
return
|
||||
;;
|
||||
$(__docker_to_extglob "$options_with_args") )
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$cur" in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W "$all_options" -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
local counter=$( __docker_pos_first_nonflag $( __docker_to_alternatives "$options_with_args" ) )
|
||||
if [ $cword -eq $counter ]; then
|
||||
_filedir -d
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
_docker_image_history() {
|
||||
|
|
Loading…
Add table
Reference in a new issue