Skip to content

Commit 1148163

Browse files
committed
Add completion for docker-compose plugin
Signed-off-by: Ulysses Souza <[email protected]>
1 parent 5f07d7d commit 1148163

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

contrib/completion/bash/docker

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

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

5575+
local known_plugin_commands=(
5576+
compose
5577+
)
5578+
55585579
local experimental_server_commands=(
55595580
checkpoint
55605581
)
55615582

5562-
local commands=(${management_commands[*]} ${top_level_commands[*]})
5583+
local commands=(${management_commands[*]} ${top_level_commands[*]} ${known_plugin_commands[*]})
55635584
[ -z "$DOCKER_HIDE_LEGACY_COMMANDS" ] && commands+=(${legacy_commands[*]})
55645585

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

0 commit comments

Comments
 (0)