diff --git a/Formula/b/bash-completion.rb b/Formula/b/bash-completion.rb index 8e6257ade6803..b013ff685d8b9 100644 --- a/Formula/b/bash-completion.rb +++ b/Formula/b/bash-completion.rb @@ -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: @@ -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