From 9ae1c1aafaa07cb0e723e714f4fac348687ff810 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Thu, 16 Jul 2020 14:21:15 +0400 Subject: [PATCH 1/8] Make Shell-Completion.md clearer and update it --- docs/Shell-Completion.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index 4ae778f446..654fd31417 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -8,7 +8,7 @@ You must configure your shell to enable its completion support. This is because ## Configuring Completions in `bash` -To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.profile` file: +To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.profile` or `~/.bash_profile` file: ```sh if type brew &>/dev/null; then @@ -23,7 +23,8 @@ if type brew &>/dev/null; then fi ``` -Should you later install the `bash-completion` formula, this will automatically use its initialization script to read the completions files. +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 (If the Caveats section is followed after installation, of course). Therefore, it is recommended to comment out the block of code given above after installing `bash-completion@2` because it becomes redundant. ## Configuring Completions in `zsh` From 7115427e781848727d7b215cb6aae494a8ab4da5 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Thu, 16 Jul 2020 18:03:51 +0400 Subject: [PATCH 2/8] Recommend commenting out the formula Caveats code --- docs/Shell-Completion.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index 654fd31417..45e65c17b0 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -24,7 +24,14 @@ 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 (If the Caveats section is followed after installation, of course). Therefore, it is recommended to comment out the block of code given above after installing `bash-completion@2` because it becomes redundant. +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` - + +``` +[[ -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` + +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` From f9d77c9d89bde50c0ba47cf1d9bdb4769b705e12 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Thu, 16 Jul 2020 21:11:35 +0400 Subject: [PATCH 3/8] Clarify which file the completion code should be added to Co-authored-by: Shaun Jackman --- docs/Shell-Completion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index 45e65c17b0..f0d56b98fb 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -8,7 +8,7 @@ You must configure your shell to enable its completion support. This is because ## Configuring Completions in `bash` -To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.profile` or `~/.bash_profile` file: +To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.bash_profile` if it exists or `~/.profile` otherwise: ```sh if type brew &>/dev/null; then From 4872d6653f77fec8dc944977f8436f3ccb780738 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Mon, 20 Jul 2020 18:24:01 +0400 Subject: [PATCH 4/8] 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` From 5a992f11944b9e55dc04f101d1f4cf681ec078ac Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Tue, 21 Jul 2020 06:18:20 +0400 Subject: [PATCH 5/8] Remove quoted completion one-liner --- docs/Shell-Completion.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index dbd116601a..6d482a90de 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -24,12 +24,7 @@ fi ``` 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` +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` which is given 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. From a613c1acd270455ffe50eb76b3819a10ee347f27 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Tue, 21 Jul 2020 06:22:44 +0400 Subject: [PATCH 6/8] Make stuff clearer, grammar stuff. --- docs/Shell-Completion.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index 6d482a90de..f9011953d7 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -28,12 +28,7 @@ When installed, the `bash-completion` formula also runs `${HOMEBREW_PREFIX}/etc/ 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. - ---- +If you are using a version of `bash` newer than version 4.1 (like Homebrew's `bash`), we recommended you use the `bash-completion@2` formula instead because 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. ## Configuring Completions in `zsh` From f7580f109eddfa1ab161b6655be29c05adbf20e3 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Tue, 21 Jul 2020 12:45:45 +0400 Subject: [PATCH 7/8] Answer what profile file should be used clearer Co-authored-by: Mike McQuaid --- docs/Shell-Completion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index f9011953d7..ea8625e439 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -8,7 +8,7 @@ You must configure your shell to enable its completion support. This is because ## Configuring Completions in `bash` -To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.bash_profile` if it exists or `~/.profile` otherwise: +To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.bash_profile` (or, if it doesn't exist, `~/.profile): ```sh if type brew &>/dev/null; then From c94196c07352bd65d7ea532fa5e958a7eb7f07e7 Mon Sep 17 00:00:00 2001 From: Ishan Goel Date: Tue, 21 Jul 2020 12:49:00 +0400 Subject: [PATCH 8/8] Brevity Co-authored-by: Mike McQuaid --- docs/Shell-Completion.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index ea8625e439..3f3191006f 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -23,12 +23,9 @@ if type brew &>/dev/null; then fi ``` -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` which is given in the Caveats section upon the installation of `bash-completion` +If you install the `bash-completion` formula, this will automatically source the completions' initialisation script (so you do not need to follow the instructions in the caveats). -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. - -If you are using a version of `bash` newer than version 4.1 (like Homebrew's `bash`), we recommended you use the `bash-completion@2` formula instead because 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. +If you are using the `bash` formula as your shell (i.e. `bash` >= v4) you should use the `bash-completion@2` formula instead. ## Configuring Completions in `zsh`