Parent directory

cask.plugin.zsh

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