- use e.g. `$HOMEBREW_*` for cases where only the environment variable
is the entire backtick-quoted string
- use e.g. `${HOMEBREW_*}` for cases where the environment variable is
part of a backtick-quoted string to make clear what parts are variable
and what parts are not
- use `export HOMEBREW_*=...` for cases where we're talking about
setting the environment variable (because it likely needs to be
exported to work how they want)
Inspired by https://github.com/Homebrew/homebrew-bundle/pull/1579 making
similar changes for Homebrew/homebrew-bundle.
Both `brew search --desc` and `brew desc --search` use API for cask and
formula searches unless `--eval-all` or `HOMEBREW_EVAL_ALL` set.
Description searches do not use the description cache or eval any
formulas/casks.
- With `--eval-all`, description search reverts to the old behavior.
- Warn if description search exludes any formulae/casks (because
`--eval-all` not set).
- Enforce `--eval-all` requirement if NO_INSTALL_FROM_API set.
- It was suggested in https://github.com/Homebrew/brew/issues/ 16733 that
`brew desc <formula_or_cask>` should work like `brew info <formula_or_cask>`
and print the description of the package without needing `--eval-all`.
- Looking at the code, it seems like it's only searching that needs
`--eval-all`, so limit the check to that.
Before:
```shell
$ brew desc hello
Error: `brew desc` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!
```
After:
```shell
$ brew desc hello
hello: Program providing model for GNU coding standards and practices
$ brew desc --search hello
Error: Invalid usage: `brew desc --search` needs `--eval-all` passed or `HOMEBREW_EVAL_ALL` set!
$ brew desc --search --eval-all hello
==> Formulae
dsh: Dancer's shell, or distributed shell
hello: Program providing model for GNU coding standards and practices
```
- Instead use class methods.
- This is better than use it as a mixin
when only a small number of methods are
used in each class or module.
- It also allows us to conditionally
require it in `brew install`.
- Removed unused search require in descriptions.rb.
- Move cask logic back into method from extend/os and check
whether to display it based on args since formula?
is passed by default on Linux now
- Use #search_descriptions in `brew desc` instead of
duplicating logic
- Remove need for extend/os/search
We added the `--all` flag (now renamed to `--eval-all`) for various
commands for this behaviour so let's start deprecating this.
Also, introduce a `HOMEBREW_EVAL_ALL` environment variable to use the
existing, less secure, behaviour by default and avoid passing
`--eval-all` everywhere.
This makes use of both the existing interfaces and could use the
existing cache file but we'll create a new one and cleanup the old one
to avoid issues and use a more consistent name.