cask.plugin.zsh 595 B

1234567891011121314151617181920212223242526
  1. () {
  2. emulate -L zsh
  3. if ! (( $+commands[cask] )); then
  4. print "zsh cask plugin: cask command not found" >&2
  5. return
  6. fi
  7. cask_base=${commands[cask]:h:h}
  8. # Plain cask installation location (for Cask 0.7.2 and earlier)
  9. comp_files=($cask_base/etc/cask_completion.zsh)
  10. # Mac Homebrew installs the completion in a different location
  11. if (( $+commands[brew] )); then
  12. comp_files+=($(brew --prefix)/share/zsh/site-functions/cask_completion.zsh)
  13. fi
  14. # Load first found file
  15. for f in $comp_files; do
  16. if [[ -f "$f" ]]; then
  17. source "$f"
  18. break
  19. fi
  20. done
  21. }