mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #29066 from albers/completion-deploy
Add bash completion for experimental `docker deploy`
This commit is contained in:
commit
2a3bbe571e
1 changed files with 16 additions and 0 deletions
|
@ -409,6 +409,13 @@ __docker_append_to_completions() {
|
||||||
COMPREPLY=( ${COMPREPLY[@]/%/"$1"} )
|
COMPREPLY=( ${COMPREPLY[@]/%/"$1"} )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# __docker_is_experimental tests whether the currently configured Docker daemon
|
||||||
|
# runs in experimental mode. If so, the function exits with 0 (true).
|
||||||
|
# Otherwise, or if the result cannot be determined, the exit value is 1 (false).
|
||||||
|
__docker_is_experimental() {
|
||||||
|
[ "$(__docker_q version -f '{{.Server.Experimental}}')" = "true" ]
|
||||||
|
}
|
||||||
|
|
||||||
# __docker_pos_first_nonflag finds the position of the first word that is neither
|
# __docker_pos_first_nonflag finds the position of the first word that is neither
|
||||||
# option nor an option's argument. If there are options that require arguments,
|
# option nor an option's argument. If there are options that require arguments,
|
||||||
# you should pass a glob describing those options, e.g. "--option1|-o|--option2"
|
# you should pass a glob describing those options, e.g. "--option1|-o|--option2"
|
||||||
|
@ -851,6 +858,7 @@ _docker_docker() {
|
||||||
*)
|
*)
|
||||||
local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" )
|
local counter=$( __docker_pos_first_nonflag "$(__docker_to_extglob "$global_options_with_args")" )
|
||||||
if [ $cword -eq $counter ]; then
|
if [ $cword -eq $counter ]; then
|
||||||
|
__docker_is_experimental && commands+=(${experimental_commands[*]})
|
||||||
COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "${commands[*]} help" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -1874,6 +1882,10 @@ _docker_daemon() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_docker_deploy() {
|
||||||
|
__docker_is_experimental && _docker_stack_deploy
|
||||||
|
}
|
||||||
|
|
||||||
_docker_diff() {
|
_docker_diff() {
|
||||||
_docker_container_diff
|
_docker_container_diff
|
||||||
}
|
}
|
||||||
|
@ -3856,6 +3868,10 @@ _docker() {
|
||||||
wait
|
wait
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local experimental_commands=(
|
||||||
|
deploy
|
||||||
|
)
|
||||||
|
|
||||||
# These options are valid as global options for all client commands
|
# These options are valid as global options for all client commands
|
||||||
# and valid as command options for `docker daemon`
|
# and valid as command options for `docker daemon`
|
||||||
local global_boolean_options="
|
local global_boolean_options="
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue