From 6864f3ae5a3acb127fe4199540d789fba1ef0bd4 Mon Sep 17 00:00:00 2001 From: Harald Albers Date: Mon, 24 Oct 2016 09:26:40 -0700 Subject: [PATCH] Move bash completion logic to new subcommand: pull Signed-off-by: Harald Albers --- contrib/completion/bash/docker | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/contrib/completion/bash/docker b/contrib/completion/bash/docker index ef07a7f7b2..84d2b4baba 100644 --- a/contrib/completion/bash/docker +++ b/contrib/completion/bash/docker @@ -2148,7 +2148,25 @@ _docker_image_prune() { } _docker_image_pull() { - _docker_pull + case "$cur" in + -*) + COMPREPLY=( $( compgen -W "--all-tags -a --disable-content-trust=false --help" -- "$cur" ) ) + ;; + *) + local counter=$(__docker_pos_first_nonflag) + if [ $cword -eq $counter ]; then + for arg in "${COMP_WORDS[@]}"; do + case "$arg" in + --all-tags|-a) + __docker_complete_image_repos + return + ;; + esac + done + __docker_complete_image_repos_and_tags + fi + ;; + esac } _docker_image_push() { @@ -3005,25 +3023,7 @@ _docker_ps() { } _docker_pull() { - case "$cur" in - -*) - COMPREPLY=( $( compgen -W "--all-tags -a --disable-content-trust=false --help" -- "$cur" ) ) - ;; - *) - local counter=$(__docker_pos_first_nonflag) - if [ $cword -eq $counter ]; then - for arg in "${COMP_WORDS[@]}"; do - case "$arg" in - --all-tags|-a) - __docker_complete_image_repos - return - ;; - esac - done - __docker_complete_image_repos_and_tags - fi - ;; - esac + _docker_image_pull } _docker_push() {