From 4bab104761c1af134e8f098d7f2d0072bb7c64c7 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Thu, 20 Oct 2016 09:16:48 +0200 Subject: [PATCH] Move bash completion logic to new subcommand: top Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index 51702b4cfc..2b95144caf 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -1629,7 +1629,17 @@ _docker_container_stop() { } _docker_container_top() { - _docker_top + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ $cword -eq $counter ]; then + __docker_complete_containers_running + fi + ;; + esac } _docker_container_unpause() { @@ -3022,17 +3032,7 @@ _docker_update() { } _docker_top() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - __docker_complete_containers_running - fi - ;; - esac + _docker_container_top } _docker_version() {