bash-completion@2: automatically read v1 completions

Closes #49224.

Signed-off-by: Bo Anderson <mail@boanderson.me>
master
Eric Knibbe 2020-01-20 14:01:12 -05:00 committed by Bo Anderson
parent 65a4cf0440
commit d89d20efe3
1 changed files with 7 additions and 5 deletions

View File

@ -3,6 +3,7 @@ class BashCompletionAT2 < Formula
homepage "https://github.com/scop/bash-completion"
url "https://github.com/scop/bash-completion/releases/download/2.10/bash-completion-2.10.tar.xz"
sha256 "123c17998e34b937ce57bb1b111cd817bc369309e9a8047c0bcf06ead4a3ec92"
revision 1
bottle do
cellar :any_skip_relocation
@ -23,7 +24,11 @@ class BashCompletionAT2 < Formula
conflicts_with "bash-completion", :because => "Differing version of same formula"
def install
inreplace "bash_completion", "readlink -f", "readlink"
inreplace "bash_completion" do |s|
s.gsub! "readlink -f", "readlink"
# Automatically read Homebrew's existing v1 completions
s.gsub! ":-/etc/bash_completion.d", ":-#{etc}/bash_completion.d"
end
system "autoreconf", "-i" if build.head?
system "./configure", "--prefix=#{prefix}"
@ -33,11 +38,8 @@ class BashCompletionAT2 < Formula
def caveats
<<~EOS
Add the following to your ~/.bash_profile:
Add the following line to your ~/.bash_profile:
[[ -r "#{etc}/profile.d/bash_completion.sh" ]] && . "#{etc}/profile.d/bash_completion.sh"
If you'd like to use existing homebrew v1 completions, add the following before the previous line:
export BASH_COMPLETION_COMPAT_DIR="#{etc}/bash_completion.d"
EOS
end