mirror of https://github.com/docker/cli.git
Use native call for listing plugins in bash completion
`docker plugin ls` now has `--format`, so there is no more need for postprocessing raw `docker plugin ls` output with `awk` any more. This will make generation of plugin lists robust against changes in `docker plugin ls` output. Signed-off-by: Harald Albers <github@albersweb.de>
This commit is contained in:
parent
7953201f9d
commit
f38bb95619
|
@ -291,13 +291,13 @@ __docker_complete_plugins_bundled() {
|
||||||
# Set DOCKER_COMPLETION_SHOW_PLUGIN_IDS=yes to also complete IDs.
|
# Set DOCKER_COMPLETION_SHOW_PLUGIN_IDS=yes to also complete IDs.
|
||||||
# For built-in pugins, see `__docker_plugins_bundled`.
|
# For built-in pugins, see `__docker_plugins_bundled`.
|
||||||
__docker_plugins_installed() {
|
__docker_plugins_installed() {
|
||||||
local fields
|
local format
|
||||||
if [ "$DOCKER_COMPLETION_SHOW_PLUGIN_IDS" = yes ] ; then
|
if [ "$DOCKER_COMPLETION_SHOW_PLUGIN_IDS" = yes ] ; then
|
||||||
fields='$1,$2'
|
format='{{.ID}} {{.Name}}'
|
||||||
else
|
else
|
||||||
fields='$2'
|
format='{{.Name}}'
|
||||||
fi
|
fi
|
||||||
__docker_q plugin ls | awk "NR>1 {print $fields}"
|
__docker_q plugin ls --format "$format"
|
||||||
}
|
}
|
||||||
|
|
||||||
# __docker_complete_plugins_installed applies completion of plugins that were installed
|
# __docker_complete_plugins_installed applies completion of plugins that were installed
|
||||||
|
|
Loading…
Reference in New Issue