Move bash completion logic to new subcommand: build
Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
parent
3ab25a8ccb
commit
bd3939dddd
@ -825,71 +825,7 @@ _docker_attach() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_docker_build() {
|
_docker_build() {
|
||||||
local options_with_args="
|
_docker_image_build
|
||||||
--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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2068,7 +2004,71 @@ _docker_image() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_docker_image_build() {
|
_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() {
|
_docker_image_history() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user