From fe4b5659863c388786986d70fa6d1bb66b00afb6 Mon Sep 17 00:00:00 2001 From: Carlo Sala Date: Fri, 30 Jun 2023 11:41:44 +0200 Subject: [PATCH] fix(docker): only load old completion if docker <23 --- plugins/docker/{ => completions}/_docker | 0 plugins/docker/docker.plugin.zsh | 7 +++++++ 2 files changed, 7 insertions(+) rename plugins/docker/{ => completions}/_docker (100%) diff --git a/plugins/docker/_docker b/plugins/docker/completions/_docker similarity index 100% rename from plugins/docker/_docker rename to plugins/docker/completions/_docker diff --git a/plugins/docker/docker.plugin.zsh b/plugins/docker/docker.plugin.zsh index 3abce6466..7777048a3 100644 --- a/plugins/docker/docker.plugin.zsh +++ b/plugins/docker/docker.plugin.zsh @@ -36,6 +36,11 @@ if (( ! $+commands[docker] )); then return fi +# Standarized $0 handling +# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html +0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}" +0="${${(M)0:#/*}:-$PWD/$0}" + { # docker version returns `Docker version 24.0.2, build cb74dfcd85` # with `s:,:` remove the comma after the version, and select third word of it @@ -50,5 +55,7 @@ fi _comps[docker]=_docker fi command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker" + else + command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker" fi } &|