These were all made `--formulae` and `--casks` for consistency but that
doesn't behave as expected because they have special behaviours in
`args`. Instead, use the singular form everywhere.
- Ensure the usage documentation always mentions casks when appropriate
- Use --formulae or --casks consistently
- Provide --formulae and --casks switches to upgrade
- Mark more switches as conflicting
It's not sufficient to do this merely on `brew upgrade` because
`brew install` and `brew reinstall` can also result in formulae being
upgraded.
This requires moving logic from `cmd/upgrade.rb` to `upgrade.rb`. To
save you searching the diff the changes that resulted from doing that:
- Query the installed formulae from class state in `FormulaInstaller`
rather than the (incomplete) list that we passed into it.
- Don't output the "Checking dependents" message. It was there for
systems and configurations where this is slow but for most users
and most installations this will be a (annoying, noisy) no-op.
Fixes https://github.com/Homebrew/brew/issues/7860
This ensures that dependencies are verified and tapped before they are
fetched. `FormulaInstaller#lock` has been moved into
`FormulaInstaller#install` to avoid locking until necessary.
While we're here, don't compute dependencies before fetching if we're
not going to use them.
Brew prints this error:
```
Error: undefined method `join' for nil:NilClass
```
because, in this code:
```ruby
puts pinned_dependents.map do |f|
"#{f.full_specified_name} #{f.pkg_version}"
end.join(", ")
```
the block is passed to `puts` and not to `map`. `.join(",")` is called on the output of `puts`.
(I think the regression was introduced in this commit: e12a7b0808353ea81d63774be1edaff81710d7a6)
Output more without requiring `--verbose` and update the messages to
make clear what we're looking for and what we found/didn't find.
This is a little more noisy but it should help explain any delays to
users and make it more obvious what's failed if something does.