107 Commits

Author SHA1 Message Date
Markus Reiter
1b9002c04a Fix type errors in postinstall. 2020-11-29 21:23:54 +01:00
Markus Reiter
2c47678b05 Add --zap flag to brew uninstall and remove brew zap. 2020-11-19 15:07:59 +01:00
Markus Reiter
f4b4fdac98 Add brew zap command. 2020-11-19 13:42:02 +01:00
Markus Reiter
5097af3b74 Support --cask flag in brew uninstall. 2020-11-18 17:30:34 +01:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Tie
afd7bb8889 make suggestions 2020-11-05 12:27:22 -05:00
Tie
30a3561448 move uninstall logic to new file 2020-11-04 16:45:52 -05:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
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
William Ma
fa7bd3bff6 args: Migrate usage of args loading methods to args.named 2020-08-23 09:02:20 -04:00
Markus Reiter
b48bc316e0 Use CLI::Parser for cask commands. 2020-08-13 05:15:15 +02:00
Markus Reiter
8a32954940 Move cask/all to just cask. 2020-08-09 01:34:07 +02:00
William Ma
907d4d7f74 Add shared methods for uninstalling, reinstalling casks 2020-08-05 11:04:40 -04:00
Markus Reiter
d4c2ffd705 Refactor CLI::Parser. 2020-07-31 15:07:17 +02:00
Markus Reiter
e14506e589 Pass args in uninstall instead of using global args. 2020-07-30 03:21:12 +02:00
Markus Reiter
c0d42dd922 Remove --force from global_options. 2020-07-28 10:31:11 +02:00
William Ma
525d1ac27d Fix PR issues 2020-07-03 10:33:38 -04:00
William Ma
1826be81f2 style: Replace Hash.new with {} 2020-07-02 15:29:58 -04:00
William Ma
eb1ea006f2 uninstall: Refactor when using --force 2020-07-02 15:28:41 -04:00
William Ma
72dcbd6fda style: Dedent cask uninstall block 2020-06-30 13:43:45 -04:00
William Ma
dff61c9eab style: Fix style issues 2020-06-30 12:21:21 -04:00
William Ma
8a05b5258a args: Refactor to load casks directly 2020-06-30 12:08:03 -04:00
William Ma
e733fa16a2 uninstall: Refactor to use AbstractCommand instead of declaring a class method 2020-06-24 15:08:42 -04:00
William Ma
90c26dadc7 uninstall: Add ability to reference casks from brew uninstall 2020-06-24 11:59:55 -04:00
skim
bb27478de0
fixes uninstall if formula is unavailable 2020-05-13 17:56:36 -07:00
Mike McQuaid
a3474e8361
uninstall: tweak paths array logic. 2020-05-10 19:22:54 +01:00
Mike Fiedler
e4823ea6fe
cmd/uninstall: fix Array comparison
In #7526 a comparison for `paths` was introduced, but if `paths` is ever
`nil`, this triggers an error.

Coercing the variable to an Array should alleviate this problem, as
`nil.to_a` produces an empty and comparable Array.

Fixes #7540

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
2020-05-10 11:28:42 -04:00
Mike McQuaid
04ae589d5c
cmd/uninstall: note etc files that stay around.
We don't remove `etc` files on uninstall. Now we have `pkgetc`, though,
we have a pretty decent guess at what files in `etc` may belong to a
given package and can warn about them being left around on uninstall.

Thoughts: should we do the same thing for `var`? I don't see it being
used nearly as consistently.
2020-05-08 10:37:51 +01:00
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Mike McQuaid
40432d86f9
cmd/uninstall: handle unparsed arguments.
If `Homebrew.args` hasn't yet been populated then `named` will return
`nil`. Instead, ensure it is an array before we try to `join` it.

This is pretty much only a test-time problem but has been causing flaky
builds.
2020-03-11 11:21:28 +00:00
Mike McQuaid
a7fe0ed847
cmd: use more and cleanup new args APIs. 2020-03-05 09:40:15 +00:00
EricFromCanada
2f7c3afeb8 cmd: improve wording of messages, spacing 2019-12-15 00:04:45 -05:00
Zach Auten
fd429d0d75 Moved kegs from ARGV to args.rb 2019-11-09 11:56:47 -05:00
EricFromCanada
6520785307 manpages: grammar fixes 2019-08-20 08:26:26 -04:00
Mike McQuaid
c4f72312ce
Fixup brew style failures. 2019-04-30 09:19:18 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
e40b171127
Rename cli_parser to cli/parser. 2019-04-17 22:16:50 +09:00
Mike McQuaid
6cb7a00f2d
cmd: remove --help headers and tweak docs. 2019-01-30 21:39:28 +00:00
Gautham Goli
f82a202995
uninstall: Use CLI::Parser to parse args 2018-12-10 23:49:19 +05:30
Markus Reiter
16618d0fc7 Use ActiveSupport’s #pluralize and #to_sentence. 2018-10-07 23:10:56 +02:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Mike McQuaid
3a2e6b82fd Make pinning more robust
Don’t autoremove pins on uninstall or upgrade and note this in the
manpage.
2018-02-05 10:59:11 +00:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Markus Reiter
d700a5ba18 Use Formatter::pluralize where possible. 2017-05-29 17:50:13 +02:00
Mike McQuaid
566d3cb58b Document all short flags. 2017-04-02 10:14:58 +01:00
Alyssa Ross
49310667b4 Revert "uninstall: remove nil requireds/dependents"
This reverts commit d7e72899e6f24dca5e02a734d5a4e64e39fc680e.
2016-12-31 12:23:53 +00:00
Alyssa Ross
bbf53ad4ab uninstall: don't comma-seperate kegs in example
The example command given in the dependency errors/warnings previously
comma-seperated the kegs, which was incorrect syntax. This fixes that.
2016-12-30 17:45:37 +00:00
Alyssa Ross
ea3a41e213 uninstall: better example in dependency warning
Previously, this only included a subset of all the kegs the user was
trying to uninstall. With this change, all named formulae/kegs will be
included in the example command.
2016-12-30 17:44:18 +00:00
Mike McQuaid
39a0fec95d uninstall: ignore deprecations when uninstalling.
Handle `MethodDeprecatedError` because we want people to be able to
uninstall regardless of the content of their formula.
2016-11-18 09:34:58 +00:00
Mike McQuaid
d7e72899e6 uninstall: remove nil requireds/dependents
These shouldn’t get here in the first place so this is a bit of a hack
pending a better fix.
2016-11-15 14:34:49 +00:00