From 5c664bba8076a56e63e5b54db6d542dbea34ef4a Mon Sep 17 00:00:00 2001 From: Ruben Sainiuc Date: Fri, 14 Oct 2016 10:11:15 +0300 Subject: [PATCH] Prevent faulty autocomplete in zsh for docker rmi Skip autocompletion when there are no docker images available Signed-off-by: Ruben Sainiuc --- plugins/docker/_docker | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index 1366fd61b..8d0e92ff3 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -151,6 +151,10 @@ __docker_complete_info_plugins() { __docker_images() { [[ $PREFIX = -* ]] && return 1 + + # Prevent autocomplete when there are no images + [[ $(_call_program commands docker $docker_options images --format "{{.ID}}") ]] || return 1 + integer ret=1 declare -a images images=(${${${(f)"$(_call_program commands docker $docker_options images)"}[2,-1]}/(#b)([^ ]##) ##([^ ]##) ##([^ ]##)*/${match[3]}:${(r:15:: :::)match[2]} in ${match[1]}})