From 7150d7328cc57891e4febc0b14a65953399669a9 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Thu, 16 Mar 2017 17:32:30 +0100 Subject: [PATCH] Fix zsh-completion for containers in status 'created' This patch makes sure that containers in the created-stated are counted as stopped containers. Otherwise if you create a container, don't run it and type: "docker rm ", followed by pressing tab in zsh, it won't show up. Signed-off-by: Nikolas Garofil Signed-off-by: Nikolas Garofil --- contrib/completion/zsh/_docker | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index be33b6c961..9f19d0fb3a 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -78,7 +78,7 @@ __docker_get_containers() { s="${${line[${begin[CONTAINER ID]},${end[CONTAINER ID]}]%% ##}[0,12]}" s="$s:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = (Exit*|Created*) ]]; then stopped=($stopped $s) else running=($running $s) @@ -100,7 +100,7 @@ __docker_get_containers() { (( $#s != 0 )) || continue s="$s:${(l:15:: :::)${${line[${begin[CREATED]},${end[CREATED]}]/ ago/}%% ##}}" s="$s, ${${${line[${begin[IMAGE]},${end[IMAGE]}]}/:/\\:}%% ##}" - if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = Exit* ]]; then + if [[ ${line[${begin[STATUS]},${end[STATUS]}]} = (Exit*|Created*) ]]; then stopped=($stopped $s) else running=($running $s)