From 4872d6653f77fec8dc944977f8436f3ccb780738 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Mon, 20 Jul 2020 18:24:01 +0400 Subject: [PATCH] Recommend bash-completion unless user has newer bash --- docs/Shell-Completion.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index f0d56b98fb..dbd116601a 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -23,15 +23,23 @@ if type brew &>/dev/null; then fi ``` -Should you later install the `bash-completion@2` formula, this will automatically use its initialization script to read the completions files. -When installed, the `bash-completion@2` formula also runs `${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh` and all files in the `bash_completion.d` directory. This is done by adding a line to your `.bash_profile` - +Should you later install the `bash-completion` formula, this will automatically use its initialization script to read the completions files. +When installed, the `bash-completion` formula also runs `${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh` and all files in the `bash_completion.d` directory. This is done by adding a line to your `.bash_profile` - ``` [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" ``` -which is mentioned in the Caveats section upon the installation of `bash-completion@2` +which is mentioned in the Caveats section upon the installation of `bash-completion` + +As both Homebrew's completion code given above and the Caveats line do the same thing, it is recommended to either not add the Caveats line or to comment the line out because Homebrew's completion code works even without installing the `bash-completion` formula. + +--- +**Note** + +If you are using a version of `bash` newer than version 4.1 (Like Homebrew's `bash`), it is recommended to use the `bash-completion@2` formula instead as it is newer and has better performance. You can check the version of `bash` you have by running `bash --version`. MacOS ships with version 3.2. + +--- -As both Homebrew's completion code given above and the Caveats line do the same thing, it is recommended to either not add the Caveats line or to comment the line out because Homebrew's completion code works even without installing the `bash-completion@2` formula. ## Configuring Completions in `zsh`