File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5486,21 +5486,21 @@ _docker_wait() {
54865486 _docker_container_wait
54875487}
54885488
5489+ COMPOSE_PLUGIN_PATH=$( docker info --format ' {{json .ClientInfo.Plugins}}' | sed -n ' s/.*"Path":"\([^"]\+docker-compose\)".*/\1/p' )
5490+
54895491_docker_compose () {
5490- local composePluginPath=" ${HOME} /.docker/cli-plugins/docker-compose"
54915492 local completionCommand=" __completeNoDesc"
5492- local resultArray=(${composePluginPath} ${completionCommand} compose)
5493- for value in " ${words[@]: 2} "
5494- do
5495- if [[ " ${value} " == " " ]] ; then
5493+ local resultArray=($COMPOSE_PLUGIN_PATH $completionCommand compose)
5494+ for value in " ${words[@]: 2} " ; do
5495+ if [ -z " $value " ]; then
54965496 resultArray+=( " ''" )
54975497 else
5498- resultArray+=( " ${ value} " )
5498+ resultArray+=( " $value " )
54995499 fi
55005500 done
5501- local result=$( eval " ${resultArray[*]} " 2> /dev/null)
5501+ local result=$( eval " ${resultArray[*]} " 2> /dev/null | grep -v ' ^:[0-9]*$ ' )
55025502
5503- COMPREPLY=( $( compgen -W " ${result%%:* } " -- " $current " ) )
5503+ COMPREPLY=( $( compgen -W " ${result} " -- " $current " ) )
55045504}
55055505
55065506_docker () {
@@ -5572,9 +5572,11 @@ _docker() {
55725572 wait
55735573 )
55745574
5575- local known_plugin_commands=(
5576- compose
5577- )
5575+ local known_plugin_commands=()
5576+
5577+ if [ -f " $COMPOSE_PLUGIN_PATH " ] ; then
5578+ known_plugin_commands+=(" compose" )
5579+ fi
55785580
55795581 local experimental_server_commands=(
55805582 checkpoint
You can’t perform that action at this time.
0 commit comments