From 5288b7e7fd9d818b1b2cd68199a190834bf014bb Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Fri, 3 Feb 2017 17:53:02 +0100 Subject: [PATCH] Refactor use of shared completion functions Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 5c9cc6c937..0fd35e51bc 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -1164,7 +1164,7 @@ _docker_container_cp() { } _docker_container_create() { - _docker_container_run + _docker_container_run_and_create } _docker_container_diff() { @@ -1434,6 +1434,12 @@ _docker_container_rm() { } _docker_container_run() { + _docker_container_run_and_create +} + +# _docker_container_run_and_create is the combined completion for `_docker_container_run` +# and `_docker_container_create` +_docker_container_run_and_create() { local options_with_args=" --add-host --attach -a @@ -1888,7 +1894,7 @@ _docker_cp() { } _docker_create() { - _docker_container_run + _docker_container_create } _docker_daemon() { @@ -2788,7 +2794,7 @@ _docker_service() { } _docker_service_create() { - _docker_service_update + _docker_service_update_and_create } _docker_service_inspect() { @@ -2922,6 +2928,12 @@ _docker_service_ps() { } _docker_service_update() { + _docker_service_update_and_create +} + +# _docker_service_update_and_create is the combined completion for `docker service create` +# and `docker service update` +_docker_service_update_and_create() { local $subcommand="${words[$subcommand_pos]}" local options_with_args="