From e636eeb6963edf52d726112155bd9712654e2381 Mon Sep 17 00:00:00 2001 From: Hu Yufan <58105986+Hyffer@users.noreply.github.com> Date: Wed, 20 Nov 2024 03:34:28 +0800 Subject: [PATCH] fix(tailscale): load completion when `tailscale` is an alias (#12726) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it work when Tailscale is installed via App Store: https://tailscale.com/kb/1080/cli?tab=macos. Co-authored-by: Marc Cornellà --- plugins/tailscale/tailscale.plugin.zsh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/tailscale/tailscale.plugin.zsh b/plugins/tailscale/tailscale.plugin.zsh index 7f0b1414a..e0e011196 100644 --- a/plugins/tailscale/tailscale.plugin.zsh +++ b/plugins/tailscale/tailscale.plugin.zsh @@ -1,4 +1,4 @@ -if (( ! $+commands[tailscale] )); then +if (( ! $+commands[tailscale] && ! $+aliases[tailscale] )); then return fi @@ -7,7 +7,12 @@ fi if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then typeset -g -A _comps autoload -Uz _tailscale - _comps[tailscale]=_tailscale + + if (( $+commands[tailscale] )); then + _comps[tailscale]=_tailscale + elif (( $+aliases[tailscale] )); then + _comps[${aliases[tailscale]:t}]=_tailscale + fi fi tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|