* Move listing all formula names in the top to speed up shell script.
* Simplify logic.
* Only search PR and check bad regex for tty?, which will benefit to
shell script.
ClosesHomebrew/homebrew#44985.
Signed-off-by: Xu Cheng <xucheng@me.com>
By directly modifying the results array with
`results[i] = "#{name} (installed)"`, it appeared on successive
iterations that the canonical name was no longer in the array, so
aliases were not removed.
See 9efe5b554c (commitcomment-12969631)ClosesHomebrew/homebrew#43433.
`brew search emacs`, with homebrew/emacs tapped:
```
real 0m2.586s
user 0m1.138s
sys 0m0.121s
```
Previously:
```
real 0m2.831s
user 0m1.385s
sys 0m0.087s
```
`brew search s`:
```
real 0m2.260s
user 0m1.201s
sys 0m0.114s
```
Previously:
```
real 0m5.953s
user 0m4.827s
sys 0m0.226s
```
ClosesHomebrew/homebrew#35696.
ClosesHomebrew/homebrew#42662.
People want to install things like GIMP using Homebrew so let's make it
easier for them to find a decent installation method.
ClosesHomebrew/homebrew#34496.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
The threading in the tap search code makes handling errors difficult. If
an API-related error is raised in one thread, it is likely to be raised
in each of the rest as well. This results in duplicated error messages,
which is ugly and bad UX.
This patch adds a synchronized queue to collect these exceptions. The
first one added to the queue is re-raised after all operations are
complete.
It's not ideal, but it's minimally invasive and I don't have the energy
or time to do a rewrite.
This patch allows users to "opt out" of using the GitHub API altogether
by setting the HOMEBREW_NO_GITHUB_API environment variable. The
value of the environment variable does not matter (it can even be
empty!).
For Bash/ZSH: export HOMEBREW_NO_GITHUB_API=1
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
For example `brew search homebrew/science` to get a list of all formulae
from that tap, even if not yet tapped.
`brew search <user>/<repo>/<substr>` or
`brew search <user>/<repo> <substr>` to grep for `<substr>`
inside of the tap `<user>/<repo>`.