023f24891b60e63f93ef65f03fa2a639a8a0f1c353cb88288466149ceeedb723571df5a1065c42259f53f80d56071804f9c84610f4ed3ef6d63fb26383e41f 839 B

123456789101112131415161718192021222324252627
  1. #compdef {pkgname}
  2. ###-begin-{pkgname}-completion-###
  3. if type compdef &>/dev/null; then
  4. _{pkgname}_completion () {
  5. local reply
  6. local si=$IFS
  7. IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" SHELL=zsh {completer} completion-server -- "${words[@]}"))
  8. IFS=$si
  9. if [ "$reply" = "__tabtab_complete_files__" ]; then
  10. _files
  11. else
  12. _describe 'values' reply
  13. fi
  14. }
  15. # When called by the Zsh completion system, this will end with
  16. # "loadautofunc" when initially autoloaded and "shfunc" later on, otherwise,
  17. # the script was "eval"-ed so use "compdef" to register it with the
  18. # completion system
  19. if [[ $zsh_eval_context == *func ]]; then
  20. _{pkgname}_completion "$@"
  21. else
  22. compdef _{pkgname}_completion {pkgname}
  23. fi
  24. fi
  25. ###-end-{pkgname}-completion-###