-
Notifications
You must be signed in to change notification settings - Fork 49
/
cf-cli.rb
41 lines (36 loc) · 1.24 KB
/
cf-cli.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
require 'formula'
class CfCli < Formula
homepage 'https://code.cloudfoundry.org/cli'
version '6.53.0'
if OS.mac?
head 'https://packages.cloudfoundry.org/edge?arch=macosx64&source=homebrew'
url 'https://packages.cloudfoundry.org/stable?release=macosx64-binary&version=6.53.0&source=homebrew'
sha256 '3d5f94759dd4aa135fb10e04c6525f2b747727cbb5789ff1a0aacce365fa9515'
elsif OS.linux?
head 'https://packages.cloudfoundry.org/edge?arch=linux64&source=homebrew'
url 'https://packages.cloudfoundry.org/stable?release=linux64-binary&version=6.53.0&source=homebrew'
sha256 '09664d1469fb8a0ddba804343121aba7d8f64ba6bfde75a53f6e29d6600b2342'
end
def install
bin.install 'cf'
(bash_completion/"cf-cli").write <<-completion
# bash completion for Cloud Foundry CLI
_cf-cli() {
# All arguments except the first one
args=("${COMP_WORDS[@]:1:$COMP_CWORD}")
# Only split on newlines
local IFS=$'\n'
# Call completion (note that the first element of COMP_WORDS is
# the executable itself)
COMPREPLY=($(GO_FLAGS_COMPLETION=1 ${COMP_WORDS[0]} "${args[@]}"))
return 0
}
complete -F _cf-cli cf
completion
doc.install 'LICENSE'
doc.install 'NOTICE'
end
test do
system "#{bin}/cf"
end
end