Add completion for docker-compose plugin

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
(cherry picked from commit 1148163c3e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Ulysses Souza 2021-06-23 09:41:00 -03:00 committed by Sebastiaan van Stijn
parent fe0cdaf027
commit b30d250320
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 22 additions and 1 deletions

View File

@ -5485,6 +5485,23 @@ _docker_wait() {
_docker_container_wait
}
_docker_compose() {
local composePluginPath="${HOME}/.docker/cli-plugins/docker-compose"
local completionCommand="__completeNoDesc"
local resultArray=(${composePluginPath} ${completionCommand} compose)
for value in "${words[@]:2}"
do
if [[ "${value}" == "" ]] ; then
resultArray+=( "''" )
else
resultArray+=( "${value}" )
fi
done
local result=$(eval "${resultArray[*]}" 2> /dev/null)
COMPREPLY=( $(compgen -W "${result%%:*}" -- "$current") )
}
_docker() {
local previous_extglob_setting=$(shopt -p extglob)
shopt -s extglob
@ -5554,11 +5571,15 @@ _docker() {
wait
)
local known_plugin_commands=(
compose
)
local experimental_server_commands=(
checkpoint
)
local commands=(${management_commands[*]} ${top_level_commands[*]})
local commands=(${management_commands[*]} ${top_level_commands[*]} ${known_plugin_commands[*]})
[ -z "$DOCKER_HIDE_LEGACY_COMMANDS" ] && commands+=(${legacy_commands[*]})
# These options are valid as global options for all client commands