-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
/
zsh-completions.rb
65 lines (54 loc) · 2.03 KB
/
zsh-completions.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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/refs/tags/0.35.0.tar.gz"
sha256 "811bb4213622720872e08d6e0857f1dd7bc12ff7aa2099a170b76301a53f4fbe"
# The main/default license is the same as Zsh (MIT-Modern-Variant); however,
# the majority of completions are BSD-3-Clause. The remainder is mostly MIT.
# A few completions use other licenses and are specifically noted below.
license all_of: [
"MIT-Modern-Variant",
"BSD-3-Clause",
"MIT",
"Apache-2.0", # _cf, _hledger
"ISC", # _rfkill
"NCSA", # _include-what-you-use
]
head "https://github.com/zsh-users/zsh-completions.git", branch: "master"
bottle do
rebuild 1
sha256 cellar: :any_skip_relocation, all: "98d3985c4c7883eceb5136fef89f1e169067fe290eb540efeb5fec4ace5396be"
end
uses_from_macos "zsh" => :test
def install
inreplace "src/_ghc", "/usr/local", HOMEBREW_PREFIX
# We install this into `pkgshare` to avoid conflicts
# with completions installed by other formulae. See:
# https://github.com/Homebrew/homebrew-core/pull/126586
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 these commands:
chmod go-w '#{HOMEBREW_PREFIX}/share'
chmod -R go-w '#{HOMEBREW_PREFIX}/share/zsh'
EOS
end
test do
(testpath/"test.zsh").write <<~EOS
fpath=(#{pkgshare} $fpath)
autoload _ack
which _ack
EOS
assert_match(/^_ack/, shell_output("zsh test.zsh"))
end
end