112 Commits

Author SHA1 Message Date
Misty De Meo
c06848c487
Fix printing MultipleVersionsInstalledError details
The refactor in 6e8f5d0958247e4b4d629866099ed2836a0e0863 means that the
exception no longer exposes the name of the package with multiple versions,
and as a result the rescuer is unable to print this information.

Because we now have a path in which MultipleVersionsInstalledError doesn't
have the name at all, we can't reasonably restore the old behaviour.
And since rack resolution happens purely internal to the function that
raises the exception, the caller has no way to know what name to use.
However, since the exception text gets printed anyway, we can just move
this text into the exception itself.

Fixes the following error:

```
Error: mpd has multiple installed versions
Error: undefined method `name' for #<MultipleVersionsInstalledError:0x00007fc6009d8870>
/usr/local/Homebrew/Library/Homebrew/cmd/uninstall.rb:137:in `rescue in uninstall'
/usr/local/Homebrew/Library/Homebrew/cmd/uninstall.rb:135:in `uninstall'
/usr/local/Homebrew/Library/Homebrew/brew.rb:119:in `<main>'
```
2020-09-09 11:56:53 -07:00
Seeker
5acdcd26d0 formula: rename installed_prefix to latest_installed_prefix 2020-09-01 09:32:32 -07:00
Mike McQuaid
344d8432d2 cli/named_args: handle missing cask tap.
Casks (and indeed formulae) don't always have taps.

Fixes #8535
2020-09-01 08:50:56 +01:00
Claudia
7d09ddc3b5
Print meaningful message on missing formula
Add an import statement needed for `MissingFormula` to be found.

Fixes #8538.

Reported-by: Nate Whetsell <nathan.whetsell@gmail.com>
2020-08-30 17:43:54 +02:00
Markus Reiter
46a93ee7bb Don't output warning to stdout. 2020-08-29 20:24:08 +02:00
Mike McQuaid
3866c0b047
Merge pull request #8483 from whoiswillma/print-correct-cask-ref
cli/named_args: Print correct cask ref when name is loaded as formula/keg
2020-08-27 08:39:14 +01:00
Markus Reiter
ceeb6e6492 Document NamedArgs. 2020-08-26 03:13:58 +02:00
William Ma
d32be75ec0 named args: Print correct cask ref when name is resolved as formula/keg 2020-08-25 11:57:01 -04:00
Bo Anderson
e3372e2a14 Lazily require some heavy files 2020-08-20 02:05:17 +01:00
Mike McQuaid
3a91c37e66
Fix RuboCop checks. 2020-08-19 17:12:32 +01:00
William Ma
a7b063efb5 named_args: Warn when cask with same name exists 2020-08-17 13:06:47 -04:00
William Ma
13bc69385c args: Move named args parsing to separate class 2020-08-14 13:49:03 -04:00