mirror of https://github.com/docker/cli.git
Detect compose plugin
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
(cherry picked from commit 5a8d7d506c
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b30d250320
commit
613b9362d0
|
@ -5485,21 +5485,21 @@ _docker_wait() {
|
||||||
_docker_container_wait
|
_docker_container_wait
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COMPOSE_PLUGIN_PATH=$(docker info --format '{{json .ClientInfo.Plugins}}' | sed -n 's/.*"Path":"\([^"]\+docker-compose\)".*/\1/p')
|
||||||
|
|
||||||
_docker_compose() {
|
_docker_compose() {
|
||||||
local composePluginPath="${HOME}/.docker/cli-plugins/docker-compose"
|
|
||||||
local completionCommand="__completeNoDesc"
|
local completionCommand="__completeNoDesc"
|
||||||
local resultArray=(${composePluginPath} ${completionCommand} compose)
|
local resultArray=($COMPOSE_PLUGIN_PATH $completionCommand compose)
|
||||||
for value in "${words[@]:2}"
|
for value in "${words[@]:2}"; do
|
||||||
do
|
if [ -z "$value" ]; then
|
||||||
if [[ "${value}" == "" ]] ; then
|
|
||||||
resultArray+=( "''" )
|
resultArray+=( "''" )
|
||||||
else
|
else
|
||||||
resultArray+=( "${value}" )
|
resultArray+=( "$value" )
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
local result=$(eval "${resultArray[*]}" 2> /dev/null)
|
local result=$(eval "${resultArray[*]}" 2> /dev/null | grep -v '^:[0-9]*$')
|
||||||
|
|
||||||
COMPREPLY=( $(compgen -W "${result%%:*}" -- "$current") )
|
COMPREPLY=( $(compgen -W "${result}" -- "$current") )
|
||||||
}
|
}
|
||||||
|
|
||||||
_docker() {
|
_docker() {
|
||||||
|
@ -5571,9 +5571,11 @@ _docker() {
|
||||||
wait
|
wait
|
||||||
)
|
)
|
||||||
|
|
||||||
local known_plugin_commands=(
|
local known_plugin_commands=()
|
||||||
compose
|
|
||||||
)
|
if [ -f "$COMPOSE_PLUGIN_PATH" ] ; then
|
||||||
|
known_plugin_commands+=("compose")
|
||||||
|
fi
|
||||||
|
|
||||||
local experimental_server_commands=(
|
local experimental_server_commands=(
|
||||||
checkpoint
|
checkpoint
|
||||||
|
|
Loading…
Reference in New Issue