helm.plugin.zsh 824 B

12345678910111213141516171819202122
  1. if (( ! $+commands[helm] )); then
  2. return
  3. fi
  4. # TODO: 2021-12-28: delete this block
  5. # Remove old generated file
  6. command rm -f "${ZSH_CACHE_DIR}/helm_completion"
  7. # TODO: 2021-12-28: remove this bit of code as it exists in oh-my-zsh.sh
  8. # Add completions folder in $ZSH_CACHE_DIR
  9. command mkdir -p "$ZSH_CACHE_DIR/completions"
  10. (( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
  11. # If the completion file does not exist, generate it and then source it
  12. # Otherwise, source it and regenerate in the background
  13. if [[ ! -f "$ZSH_CACHE_DIR/completions/_helm" ]]; then
  14. helm completion zsh >| "$ZSH_CACHE_DIR/completions/_helm"
  15. source "$ZSH_CACHE_DIR/completions/_helm"
  16. else
  17. source "$ZSH_CACHE_DIR/completions/_helm"
  18. helm completion zsh >| "$ZSH_CACHE_DIR/completions/_helm" &|
  19. fi