Skip to content

Commit b30d250

Browse files
ulyssessouzathaJeztah
authored andcommitted
Add completion for docker-compose plugin
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com> (cherry picked from commit 1148163) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent fe0cdaf commit b30d250

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

contrib/completion/bash/docker

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5485,6 +5485,23 @@ _docker_wait() {
54855485
_docker_container_wait
54865486
}
54875487

5488+
_docker_compose() {
5489+
local composePluginPath="${HOME}/.docker/cli-plugins/docker-compose"
5490+
local completionCommand="__completeNoDesc"
5491+
local resultArray=(${composePluginPath} ${completionCommand} compose)
5492+
for value in "${words[@]:2}"
5493+
do
5494+
if [[ "${value}" == "" ]] ; then
5495+
resultArray+=( "''" )
5496+
else
5497+
resultArray+=( "${value}" )
5498+
fi
5499+
done
5500+
local result=$(eval "${resultArray[*]}" 2> /dev/null)
5501+
5502+
COMPREPLY=( $(compgen -W "${result%%:*}" -- "$current") )
5503+
}
5504+
54885505
_docker() {
54895506
local previous_extglob_setting=$(shopt -p extglob)
54905507
shopt -s extglob
@@ -5554,11 +5571,15 @@ _docker() {
55545571
wait
55555572
)
55565573

5574+
local known_plugin_commands=(
5575+
compose
5576+
)
5577+
55575578
local experimental_server_commands=(
55585579
checkpoint
55595580
)
55605581

5561-
local commands=(${management_commands[*]} ${top_level_commands[*]})
5582+
local commands=(${management_commands[*]} ${top_level_commands[*]} ${known_plugin_commands[*]})
55625583
[ -z "$DOCKER_HIDE_LEGACY_COMMANDS" ] && commands+=(${legacy_commands[*]})
55635584

55645585
# These options are valid as global options for all client commands

0 commit comments

Comments
 (0)