1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-01-10 21:58:06 +08:00

fix(tailscale): completion when tailscale is alias

This commit is contained in:
huyufan 2024-10-05 12:18:50 +08:00
parent 62cf1201b0
commit 7a90b50f7c

View File

@ -1,4 +1,4 @@
if (( ! $+commands[tailscale] )); then
if (( ! ($+commands[tailscale] || $+aliases[tailscale]) )); then
return
fi
@ -8,6 +8,10 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then
typeset -g -A _comps
autoload -Uz _tailscale
_comps[tailscale]=_tailscale
if (( $+aliases[tailscale] )); then
# `basename "$(alias tailscale | sed "s/.*=\(.*\)/\1/")"` should output executable name
compdef "$(basename "$(alias tailscale | sed "s/.*=\(.*\)/\1/")")"="tailscale"
fi
fi
tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|