mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-26 23:00:30 +08:00
fix(core): move plugin-generated completion files to $ZSH_CACHE_DIR/completions
Fixes #10183
This commit is contained in:
parent
4e6e49652b
commit
d2269180b0
@ -7,6 +7,10 @@ if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="$ZSH/cache"
|
||||
fi
|
||||
|
||||
# Create completions cache dir and add to $fpath
|
||||
mkdir -p "$ZSH_CACHE_DIR/completions"
|
||||
(( ${fpath[(Ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
|
||||
|
||||
# Check for updates on initial load...
|
||||
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
|
||||
source $ZSH/tools/check_for_upgrade.sh
|
||||
|
@ -1,7 +1,10 @@
|
||||
if (( $+commands[rustup] && $+commands[cargo] )); then
|
||||
ver="$(cargo --version)"
|
||||
ver_file="$ZSH_CACHE_DIR/cargo_version"
|
||||
comp_file="$ZSH/plugins/cargo/_cargo"
|
||||
comp_file="$ZSH_CACHE_DIR/completions/_cargo"
|
||||
|
||||
mkdir -p "${comp_file:h}"
|
||||
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
|
||||
|
||||
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
||||
rustup completions zsh cargo >| "$comp_file"
|
||||
|
@ -14,7 +14,10 @@ alias dup='deno upgrade'
|
||||
if (( $+commands[deno] )); then
|
||||
ver="$(deno --version)"
|
||||
ver_file="$ZSH_CACHE_DIR/deno_version"
|
||||
comp_file="$ZSH/plugins/deno/_deno"
|
||||
comp_file="$ZSH_CACHE_DIR/completions/_deno"
|
||||
|
||||
mkdir -p "${comp_file:h}"
|
||||
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
|
||||
|
||||
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
||||
deno completions zsh >| "$comp_file"
|
||||
|
@ -1,7 +1,10 @@
|
||||
if (( $+commands[fnm] )); then
|
||||
ver="$(fnm --version)"
|
||||
ver_file="$ZSH_CACHE_DIR/fnm_version"
|
||||
comp_file="$ZSH/plugins/fnm/_fnm"
|
||||
comp_file="$ZSH_CACHE_DIR/completions/_fnm"
|
||||
|
||||
mkdir -p "${comp_file:h}"
|
||||
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
|
||||
|
||||
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
||||
fnm completions --shell=zsh >| "$comp_file"
|
||||
|
@ -2,7 +2,10 @@
|
||||
if (( $+commands[gh] )); then
|
||||
ver="$(gh --version)"
|
||||
ver_file="$ZSH_CACHE_DIR/gh_version"
|
||||
comp_file="$ZSH/plugins/gh/_gh"
|
||||
comp_file="$ZSH_CACHE_DIR/completions/_gh"
|
||||
|
||||
mkdir -p "${comp_file:h}"
|
||||
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
|
||||
|
||||
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
||||
gh completion --shell zsh >| "$comp_file"
|
||||
|
@ -1,7 +1,10 @@
|
||||
if (( $+commands[rustup] )); then
|
||||
ver="$(rustup --version 2>/dev/null)"
|
||||
ver_file="$ZSH_CACHE_DIR/rustup_version"
|
||||
comp_file="$ZSH/plugins/rustup/_rustup"
|
||||
comp_file="$ZSH_CACHE_DIR/completions/_rustup"
|
||||
|
||||
mkdir -p "${comp_file:h}"
|
||||
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
|
||||
|
||||
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
||||
rustup completions zsh >| "$comp_file"
|
||||
|
Loading…
Reference in New Issue
Block a user