1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 11:54:24 +08:00

fix(core): move plugin-generated completion files to $ZSH_CACHE_DIR/completions

Fixes #10183
This commit is contained in:
Marc Cornellà 2021-09-15 18:41:44 +02:00
parent 4e6e49652b
commit d2269180b0
No known key found for this signature in database
GPG Key ID: 0314585E776A9C1B
6 changed files with 24 additions and 5 deletions

View File

@ -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

View File

@ -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"

View 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"

View 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"

View 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"

View 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"