浏览代码

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.
Marc Cornellà 2 年之前
父节点
当前提交
eb2eacaf0c

+ 0 - 1
plugins/cargo/.gitignore

@@ -1 +0,0 @@
-_cargo

+ 4 - 0
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"

+ 0 - 1
plugins/deno/.gitignore

@@ -1 +0,0 @@
-_deno

+ 3 - 0
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"

+ 0 - 2
plugins/fnm/.gitignore

@@ -1,2 +0,0 @@
-_fnm
-

+ 3 - 0
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"

+ 0 - 1
plugins/gh/.gitignore

@@ -1 +0,0 @@
-_gh

+ 3 - 0
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"

+ 0 - 1
plugins/rustup/.gitignore

@@ -1 +0,0 @@
-_rustup

+ 3 - 0
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"