Skip to content

Commit

Permalink
bash-completion: add caveat for brew bash and Linux users
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Aug 17, 2024
1 parent 925c7ab commit 81f4854
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Formula/b/bash-completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ class BashCompletion < Formula
conflicts_with "util-linux", because: "both install `mount`, `rfkill`, and `rtcwake` completions"
end

conflicts_with "bash-completion@2",
because: "each are different versions of the same formula"
conflicts_with "bash-completion@2", because: "each are different versions of the same formula"
conflicts_with "medusa", because: "both install `medusa` bash completion"

# Backports the following upstream patch from 2.x:
Expand All @@ -58,10 +57,23 @@ def install
end

def caveats
<<~EOS
s = <<~EOS
Add the following line to your ~/.bash_profile:
[[ -r "#{etc}/profile.d/bash_completion.sh" ]] && . "#{etc}/profile.d/bash_completion.sh"
EOS
version_caveat = <<~EOS
This formula is mainly for use with Bash 3. If you are using Homebrew's Bash or your
system Bash is at least version 4.2, then you should install `bash-completion@2` instead.
EOS
if Formula["bash"].any_version_installed?
s += version_caveat
else
on_linux do
s += version_caveat
end
end
s
end

test do
Expand Down

0 comments on commit 81f4854

Please sign in to comment.