- 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.
We already have `--skip-post-install` and this adds similar behaviour
for e.g. `brew bundle` (and other users) to be able to install a
formula but skip the `brew link` stage afterwards.
These can return `true`, `false` or `nil` so adjust the signature to
note this and fix the call sites to ensure we don't accidentally pass
through `nil` values when we shouldn't.
While we're here, make a `TODO` to fix this bad API up in future.
Fixes https://github.com/Homebrew/brew/issues/19076
I accidentally typed `brew update --greedy` instead of `brew upgrade --greedy` and got some strange output.
This fix causes unrecognized long options to throw a usage message and exit like all the other subcommands.
Before:
```
% brew update --greedy
==> Updating Homebrew...
Usage: brew update-report [--auto-update] [--force]
The Ruby implementation of brew update. Never called manually.
[...]
```
After:
```
% brew update --greedy
Error: Unrecognized option '--greedy'
Usage: brew update, up [options]
Fetch the newest version of Homebrew and all formulae from GitHub using git(1)
and perform any necessary migrations.
[...]
```
'brew list --cask --version' produces an unsorted list.
Also, the cask part of 'brew list --version' is unsorted, while the
formulas are (still) sorted.
When a cask is renamed (e.g. logi-options-plus to logi-options+),
Homebrew creates a symlink in the Caskroom directory. Currently,
`brew list --cask` shows both the original and symlinked cask as
separate entries. This patch modifies the listing logic to resolve
symlinks and show only unique casks.
Fixes#18849
This seems like it was a bug before the recent change to remove
OpenStruct from `Homebrew::CLI::Args` but it was failing silently
before. Now we pass the args to the `Cask::Info.info` method so
that when they eventually reach the `Utils::Analytics.output_analytics`
method they are present as expected.
Example error fragment:
```console
$ set -e HOMEBREW_NO_ANALYTICS
$ brew info iterm2 --cask --verbose
==> iterm2: 3.5.10 (auto_updates)
https://iterm2.com/
Installed
/usr/local/Caskroom/iterm2/3.5.4 (91.7MB)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/i/iterm2.rb
==> Name
iTerm2
==> Description
Terminal emulator as alternative to Apple's Terminal app
==> Artifacts
iTerm.app (App)
Error: undefined method `analytics?' for an instance of Homebrew::CLI::Args
/usr/local/Homebrew/Library/Homebrew/utils/analytics.rb:248:in `output_analytics'
/usr/local/Homebrew/Library/Homebrew/utils/analytics.rb:342:in `cask_output'
/usr/local/Homebrew/Library/Homebrew/cask/info.rb:39:in `info'
```
Checking for `HOMEBREW_NO_INSTALL_CLEANUP` was added in #18825, but this
breaks developers by switching them to the stable branch.
Setting `HOMEBREW_NO_UPDATE_CLEANUP` when `HOMEBREW_NO_INSTALL_CLEANUP`
is set seems like a relatively recent addition, so I don't think it
hurts to just remove it. We can add it back (correctly) if there are
users that need it.
- `reinstall` and `upgrade` no longer mark as installed on request,
with or without names specified, but preserve the version from the
tab instead
- default `install_on_request` to `false` rather than `true`
- only set installed in request in a tab if it's missing rather than
false
Co-authored-by: Michael Cho <michael@michaelcho.dev>
The --build-from-source flag can currently be used without specifying
a formula by name but it doesn't behave the way you'd expect it to.
It will upgrade everything using bottles if they are available and skip
building things from source. This is intentional because we want to
discourage non-developers from building packages from source since the
result is less predictable.
The change here is to error out in that case. It might be smarter to
go through the entire deprecation cycle here just in case someone
is using this in scripts.
I considered doing a fallthough in the case-statement, but that doesn't work on bash leq 4 (notably, those versions shipped with MacOS by default).
I chose to prepend the value to the array to mirror the homebrew completion [instructions page](https://docs.brew.sh/Shell-Completion).
I also chose to leave off the `-d`irectory check -- zsh seems to tolerate invalid paths, so there isn't much harm in adding it anyway.
I'm flexible on any of these choices should someone feel strongly. However, I imagine this is the best combination given the trade-offs we have.
Copy and tweak code from Library/Homebrew/system_config.rb:110 to commit
and date information. This information can be useful when debugging
formulae in custom taps to ensure the tap has been correctly updated
recently or to suss out important differences from one version of a tap
to another.
This removes the need to ask users to run something like
git -C $(brew --repository)/Library/Taps/<tap> show -s --decorate
Close https://github.com/Homebrew/brew/issues/18381