diff options
author | Marc Cornellà <hello@mcornella.com> | 2021-09-15 18:41:44 +0200 |
---|---|---|
committer | Marc Cornellà <hello@mcornella.com> | 2021-09-15 18:41:44 +0200 |
commit | d2269180b074263f4a0d3df3f9de15a1abae8110 (patch) | |
tree | 854d05b304d141f55708af51001899d763361496 | |
parent | 4e6e49652b69557c01ef1ce81c96da7eb9b34e6e (diff) | |
download | zsh-d2269180b074263f4a0d3df3f9de15a1abae8110.tar.gz zsh-d2269180b074263f4a0d3df3f9de15a1abae8110.tar.bz2 zsh-d2269180b074263f4a0d3df3f9de15a1abae8110.zip |
fix(core): move plugin-generated completion files to `$ZSH_CACHE_DIR/completions`
Fixes #10183
-rw-r--r-- | oh-my-zsh.sh | 4 | ||||
-rw-r--r-- | plugins/cargo/cargo.plugin.zsh | 5 | ||||
-rw-r--r-- | plugins/deno/deno.plugin.zsh | 5 | ||||
-rw-r--r-- | plugins/fnm/fnm.plugin.zsh | 5 | ||||
-rw-r--r-- | plugins/gh/gh.plugin.zsh | 5 | ||||
-rw-r--r-- | plugins/rustup/rustup.plugin.zsh | 5 |
6 files changed, 24 insertions, 5 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 16e244be5..442972a9a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -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 diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh index b636d492f..95e63dd3c 100644 --- a/plugins/cargo/cargo.plugin.zsh +++ b/plugins/cargo/cargo.plugin.zsh @@ -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" diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index 71749f4a0..e22c4e4c8 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -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" diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh index 29b759abb..efb81a6fa 100644 --- a/plugins/fnm/fnm.plugin.zsh +++ b/plugins/fnm/fnm.plugin.zsh @@ -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" diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh index c3d87848d..a346ccf65 100644 --- a/plugins/gh/gh.plugin.zsh +++ b/plugins/gh/gh.plugin.zsh @@ -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" diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh index e709f41bd..8740f255a 100644 --- a/plugins/rustup/rustup.plugin.zsh +++ b/plugins/rustup/rustup.plugin.zsh @@ -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" |