homebrew-core/Formula/zsh-completions.rb

45 lines
1.2 KiB
Ruby

class ZshCompletions < Formula
desc "Additional completion definitions for zsh"
homepage "https://github.com/zsh-users/zsh-completions"
url "https://github.com/zsh-users/zsh-completions/archive/0.32.0.tar.gz"
sha256 "d2d20836fb60d2e5de11b08f1a8373484dc01260d224e64c6de9eec44137fa63"
head "https://github.com/zsh-users/zsh-completions.git"
bottle :unneeded
def install
pkgshare.install Dir["src/_*"]
end
def caveats
<<~EOS
To activate these completions, add the following to your .zshrc:
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh-completions:$FPATH
autoload -Uz compinit
compinit
fi
You may also need to force rebuild `zcompdump`:
rm -f ~/.zcompdump; compinit
Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting
to load these completions, you may need to run this:
chmod go-w '#{HOMEBREW_PREFIX}/share'
EOS
end
test do
(testpath/"test.zsh").write <<~EOS
fpath=(#{pkgshare} $fpath)
autoload _ack
which _ack
EOS
assert_match /^_ack/, shell_output("/bin/zsh test.zsh")
end
end