mirror of https://github.com/docker/cli.git
Merge pull request #4519 from thaJeztah/20.10_backport_docker-cli-slows-bash-init
[20.10 backport] Stop slowing bash init by caching plugins path slowly
This commit is contained in:
commit
12df1c1054
|
@ -1184,7 +1184,10 @@ __docker_complete_user_group() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
DOCKER_PLUGINS_PATH=$(docker info --format '{{range .ClientInfo.Plugins}}{{.Path}}:{{end}}')
|
__docker_plugins_path() {
|
||||||
|
local docker_plugins_path=$(docker info --format '{{range .ClientInfo.Plugins}}{{.Path}}:{{end}}')
|
||||||
|
echo "${docker_plugins_path//:/ }"
|
||||||
|
}
|
||||||
|
|
||||||
__docker_complete_plugin() {
|
__docker_complete_plugin() {
|
||||||
local path=$1
|
local path=$1
|
||||||
|
@ -5572,7 +5575,7 @@ _docker() {
|
||||||
# Create completion functions for all registered plugins
|
# Create completion functions for all registered plugins
|
||||||
local known_plugin_commands=()
|
local known_plugin_commands=()
|
||||||
local plugin_name=""
|
local plugin_name=""
|
||||||
for plugin_path in ${DOCKER_PLUGINS_PATH//:/ }; do
|
for plugin_path in $(__docker_plugins_path); do
|
||||||
plugin_name=$(basename "$plugin_path" | sed 's/ *$//')
|
plugin_name=$(basename "$plugin_path" | sed 's/ *$//')
|
||||||
plugin_name=${plugin_name#docker-}
|
plugin_name=${plugin_name#docker-}
|
||||||
plugin_name=${plugin_name%%.*}
|
plugin_name=${plugin_name%%.*}
|
||||||
|
|
Loading…
Reference in New Issue