mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
Optimize and use idiomatic zsh
This commit is contained in:
parent
7a90b50f7c
commit
af41403a5b
1 changed files with 6 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
if (( ! ($+commands[tailscale] || $+aliases[tailscale]) )); then
|
if (( ! $+commands[tailscale] && ! $+aliases[tailscale] )); then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -7,10 +7,11 @@ fi
|
||||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_tailscale" ]]; then
|
||||||
typeset -g -A _comps
|
typeset -g -A _comps
|
||||||
autoload -Uz _tailscale
|
autoload -Uz _tailscale
|
||||||
_comps[tailscale]=_tailscale
|
|
||||||
if (( $+aliases[tailscale] )); then
|
if (( $+commands[tailscale] )); then
|
||||||
# `basename "$(alias tailscale | sed "s/.*=\(.*\)/\1/")"` should output executable name
|
_comps[tailscale]=_tailscale
|
||||||
compdef "$(basename "$(alias tailscale | sed "s/.*=\(.*\)/\1/")")"="tailscale"
|
elif (( $+aliases[tailscale] )); then
|
||||||
|
_comps[${aliases[tailscale]:t}]=_tailscale
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue