14 Commits

Author SHA1 Message Date
Andy Lester
953a1bf20b Add quotes around the brew invocation 2019-10-11 08:51:43 -05:00
Andy Lester
c296c5f2d3
bash completion should not call brew if brew doesn't exist
In the section "Configuring Completions in `bash`", there's a line of code that sets `HOMEBREW_PREFIX` by calling `brew --prefix`, but it's done before calling `type brew` to see if brew exists.  This gives a "-bash: brew: command not found" if you don't have brew installed. That line should be moved inside the `if`.
2019-10-02 09:00:23 -05:00
Lawrence
109d2a6d0e Deleted comment in parentheses 2019-09-07 18:21:01 -04:00
Lawrence
994d92ab32 Fixed website documentation to mark that brew provides fish completions 2019-09-07 17:26:15 -04:00
EricFromCanada
56263791c8 docs: account for bash-completion in suggested script
This runs the `bash-completion` initialization script if available, and loads each file in `{etc}/bash_completion.d` otherwise.
2019-07-24 15:54:07 -04:00
Matthew Rothenberg
dc30e9f64d
speedup bash completion loading suggestion in docs
The current suggestion for users shells out to `brew --prefix` three separate times, which has a non-zero overhead (as per quick benchmark below, approx 20ms per invocation). By making a minor change, the first invocation can be stored in a local variable to reduce shell startup time.

```
$ hyperfine --warmup=3 'brew --prefix'       
Benchmark #1: brew --prefix
  Time (mean ± σ):      21.3 ms ±   1.5 ms    [User: 8.8 ms, System: 10.6 ms]
  Range (min … max):    20.3 ms …  37.0 ms    128 runs
```
2019-05-07 12:36:02 -04:00
Mike McQuaid
439283c3df
Shell-Completion: recommend .bash_profile
`.bashrc` is not the right location for shell completions.
2019-03-30 10:01:16 +00:00
Mike McQuaid
ea379a84a6
Shell-Completion: fix redirection.
Fixes the issue noted in https://github.com/Homebrew/brew/pull/5625.
2019-02-21 16:25:47 +00:00
Mike McQuaid
f8c574bbc0
docs/Shell-Completion: read both types of bash completions.
And guard against either of them being missing.

Fixes #5610
2019-01-28 16:36:07 +00:00
Ian Max Andolina
030ddc9762
Update Shell-Completion.md
Please see https://discourse.brew.sh/t/bash-completion-and-brew-instructions-for-setting-up-completions/3808 for details...
2019-01-09 09:08:32 +08:00
Richard Schneeman
1dcf8c689c
Update bash completion docs
When I try to run the proposed script in my `~/.bashrc` file I get this output:

```
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: have: command not found
-bash: [: =: unary operator expected
# ...
```

It goes on for quite some time and does not give me bash completion.

When I execute `source "$(brew --prefix)/etc/bash_completion"` it works and I get bash completion.

This script also emits a helpful error message letting people know if bash completion was not installed already.

I'll also add that the bash completion script takes a fairly long amount of time. I've seen between one quarter and a half of a second to execute it:

```
$ time source "$(brew --prefix)/etc/bash_completion"

real	0m0.254s
```

Though that's unrelated to this PR, making a note of it.
2018-12-06 12:04:08 -06:00
EricFromCanada
31dbc4f985 Various documentation edits
Mostly edits to formatting, grammar, wording for consistency & readability.
2018-10-05 17:23:22 -04:00
Mike McQuaid
c1376f9f18
docs: various updates.
I read through the docs locally and made various fixes.
2018-09-06 15:07:00 +01:00
Andrew Janke
36e961ad98 Doco: add a Shell Completion doc
This describes how to configure your shell to use Homebrew-managed completion
definitions. Needed because this is a manual step the user has to do.
2018-05-22 08:11:31 -04:00