From eb2eacaf0c46ace8e0eb3543199851a8249338fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Wed, 15 Sep 2021 18:47:51 +0200 Subject: [PATCH] refactor(plugins): remove old generated completion files This removes .gitignore plugin files and adds a force-rm of the old completion file, which ignores any errors if the file doesn't exist. --- plugins/cargo/.gitignore | 1 - plugins/cargo/cargo.plugin.zsh | 4 ++++ plugins/deno/.gitignore | 1 - plugins/deno/deno.plugin.zsh | 3 +++ plugins/fnm/.gitignore | 2 -- plugins/fnm/fnm.plugin.zsh | 3 +++ plugins/gh/.gitignore | 1 - plugins/gh/gh.plugin.zsh | 3 +++ plugins/rustup/.gitignore | 1 - plugins/rustup/rustup.plugin.zsh | 3 +++ 10 files changed, 16 insertions(+), 6 deletions(-) delete mode 100644 plugins/cargo/.gitignore delete mode 100644 plugins/deno/.gitignore delete mode 100644 plugins/fnm/.gitignore delete mode 100644 plugins/gh/.gitignore delete mode 100644 plugins/rustup/.gitignore diff --git a/plugins/cargo/.gitignore b/plugins/cargo/.gitignore deleted file mode 100644 index 42d7ecdd6..000000000 --- a/plugins/cargo/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_cargo diff --git a/plugins/cargo/cargo.plugin.zsh b/plugins/cargo/cargo.plugin.zsh index 95e63dd3c..7082d2d55 100644 --- a/plugins/cargo/cargo.plugin.zsh +++ b/plugins/cargo/cargo.plugin.zsh @@ -1,4 +1,8 @@ if (( $+commands[rustup] && $+commands[cargo] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_cargo" + + # generate new completion file ver="$(cargo --version)" ver_file="$ZSH_CACHE_DIR/cargo_version" comp_file="$ZSH_CACHE_DIR/completions/_cargo" diff --git a/plugins/deno/.gitignore b/plugins/deno/.gitignore deleted file mode 100644 index cba5b03e8..000000000 --- a/plugins/deno/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_deno diff --git a/plugins/deno/deno.plugin.zsh b/plugins/deno/deno.plugin.zsh index e22c4e4c8..34adddc37 100644 --- a/plugins/deno/deno.plugin.zsh +++ b/plugins/deno/deno.plugin.zsh @@ -12,6 +12,9 @@ alias dup='deno upgrade' # COMPLETION FUNCTION if (( $+commands[deno] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_deno" + ver="$(deno --version)" ver_file="$ZSH_CACHE_DIR/deno_version" comp_file="$ZSH_CACHE_DIR/completions/_deno" diff --git a/plugins/fnm/.gitignore b/plugins/fnm/.gitignore deleted file mode 100644 index 0b2bc9ab7..000000000 --- a/plugins/fnm/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -_fnm - diff --git a/plugins/fnm/fnm.plugin.zsh b/plugins/fnm/fnm.plugin.zsh index efb81a6fa..c161b27cd 100644 --- a/plugins/fnm/fnm.plugin.zsh +++ b/plugins/fnm/fnm.plugin.zsh @@ -1,4 +1,7 @@ if (( $+commands[fnm] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_fnm" + ver="$(fnm --version)" ver_file="$ZSH_CACHE_DIR/fnm_version" comp_file="$ZSH_CACHE_DIR/completions/_fnm" diff --git a/plugins/gh/.gitignore b/plugins/gh/.gitignore deleted file mode 100644 index fa1244ab5..000000000 --- a/plugins/gh/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_gh diff --git a/plugins/gh/gh.plugin.zsh b/plugins/gh/gh.plugin.zsh index a346ccf65..3e4cdee5e 100644 --- a/plugins/gh/gh.plugin.zsh +++ b/plugins/gh/gh.plugin.zsh @@ -1,5 +1,8 @@ # Autocompletion for the GitHub CLI (gh). if (( $+commands[gh] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_gh" + ver="$(gh --version)" ver_file="$ZSH_CACHE_DIR/gh_version" comp_file="$ZSH_CACHE_DIR/completions/_gh" diff --git a/plugins/rustup/.gitignore b/plugins/rustup/.gitignore deleted file mode 100644 index ad38ae3bf..000000000 --- a/plugins/rustup/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_rustup diff --git a/plugins/rustup/rustup.plugin.zsh b/plugins/rustup/rustup.plugin.zsh index 8740f255a..c6efc1b13 100644 --- a/plugins/rustup/rustup.plugin.zsh +++ b/plugins/rustup/rustup.plugin.zsh @@ -1,4 +1,7 @@ if (( $+commands[rustup] )); then + # remove old generated completion file + command rm -f "${0:A:h}/_rustup" + ver="$(rustup --version 2>/dev/null)" ver_file="$ZSH_CACHE_DIR/rustup_version" comp_file="$ZSH_CACHE_DIR/completions/_rustup"